mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
update
This commit is contained in:
parent
408283e84e
commit
d163ea76a1
2 changed files with 19 additions and 20 deletions
|
|
@ -5,6 +5,24 @@ from dotenv import load_dotenv
|
|||
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
CONFIG_FILE_URL = environ.get("CONFIG_FILE_URL", "")
|
||||
try:
|
||||
if len(CONFIG_FILE_URL) == 0:
|
||||
raise TypeError
|
||||
try:
|
||||
res = requests.get(CONFIG_FILE_URL)
|
||||
if res.status_code == 200:
|
||||
with open("config.env", "wb+") as f:
|
||||
f.write(res.content)
|
||||
else:
|
||||
LOGGER.error(f"config.env err: {res.status_code}")
|
||||
except Exception as e:
|
||||
LOGGER.error(f"ENV_URL: {e}")
|
||||
except:
|
||||
pass
|
||||
|
||||
load_dotenv("config.env", override=True)
|
||||
|
||||
def getConfig(name: str):
|
||||
try:
|
||||
return environ[name]
|
||||
|
|
|
|||
21
update.py
21
update.py
|
|
@ -1,27 +1,8 @@
|
|||
import requests
|
||||
from subprocess import run as srun
|
||||
import logging, os, dotenv
|
||||
import logging, os
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_FILE_URL = os.environ.get("CONFIG_FILE_URL", "")
|
||||
try:
|
||||
if len(CONFIG_FILE_URL) == 0:
|
||||
raise TypeError
|
||||
try:
|
||||
res = requests.get(CONFIG_FILE_URL)
|
||||
if res.status_code == 200:
|
||||
with open("config.env", "wb+") as f:
|
||||
f.write(res.content)
|
||||
else:
|
||||
LOGGER.error(f"config.env err: {res.status_code}")
|
||||
except Exception as e:
|
||||
LOGGER.error(f"ENV_URL: {e}")
|
||||
except:
|
||||
pass
|
||||
|
||||
dotenv.load_dotenv("config.env", override=True)
|
||||
|
||||
UPSTREAM_REPO = os.environ.get("UPSTREAM_REPO", "")
|
||||
if len(UPSTREAM_REPO) == 0:
|
||||
UPSTREAM_REPO = None
|
||||
|
|
|
|||
Loading…
Reference in a new issue