Skip to content

Commit

Permalink
Fix env to config bug
Browse files Browse the repository at this point in the history
  • Loading branch information
EstrellaXD committed Apr 24, 2023
1 parent f2693c0 commit 608f2c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
11 changes: 2 additions & 9 deletions docs/docker-compose/qBittorrent+AutoBangumi/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,16 @@ services:
- TZ=Asia/Shanghai
- PGID=${GID}
- PUID=${UID}
- AB_INTERVAL_TIME=1800
- AB_DOWNLOADER_HOST=qbittorrent:${QB_PORT}
- AB_DOWNLOADER_USERNAME=admin
- AB_DOWNLOADER_PASSWORD=adminadmin
- AB_METHOD=pn
- AB_GROUP_TAG=True
- AB_NOT_CONTAIN=720
- AB_DOWNLOAD_PATH=/downloads/Bangumi
- AB_RSS=${RSS}
- AB_DEBUG_MODE=False
- AB_EP_COMPLETE=False
volumes:
- auto_bangumi:/config
networks:
- auto_bangumi
- /path/to/config:/app/config
- /path/to/data:/app/data
ports:
- 7892:7892
dns:
Expand All @@ -57,5 +52,3 @@ networks:
volumes:
qb_config:
external: false
auto_bangumi:
external: false
10 changes: 2 additions & 8 deletions src/module/conf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,8 @@ def load_config_from_file(path: str) -> Config:

def _val_from_env(env: str, attr: tuple):
if isinstance(attr, tuple):
if attr[1] == "bool":
return os.environ[env].lower() == "true"
elif attr[1] == "int":
return int(os.environ[env])
elif attr[1] == "float":
return float(os.environ[env])
else:
return os.environ[env]
conv_func = attr[1]
return conv_func(os.environ[env])
else:
return os.environ[env]

Expand Down

0 comments on commit 608f2c0

Please sign in to comment.