mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-02 02:44:50 +00:00
Add read config.env from url
This commit is contained in:
parent
0c5dd2369c
commit
92a657d098
1 changed files with 13 additions and 2 deletions
|
|
@ -1,12 +1,23 @@
|
|||
import sys
|
||||
from logging import getLogger
|
||||
from os import environ
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv("config.env", override=True)
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
CONFIG_FILE_URL = environ.get("CONFIG_FILE_URL", "")
|
||||
if len(CONFIG_FILE_URL) != 0:
|
||||
try:
|
||||
res = get(CONFIG_FILE_URL)
|
||||
if res.status_code == 200:
|
||||
with open("config.env", "wb+") as f:
|
||||
f.write(res.content)
|
||||
else:
|
||||
logging.error(f"Failed to download config.env {res.status_code}")
|
||||
except Exception as e:
|
||||
logging.error(f"CONFIG_FILE_URL: {e}")
|
||||
|
||||
load_dotenv("config.env", override=True)
|
||||
|
||||
def getConfig(name: str):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue