mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-09 21:14:52 +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__)
|
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):
|
def getConfig(name: str):
|
||||||
try:
|
try:
|
||||||
return environ[name]
|
return environ[name]
|
||||||
|
|
|
||||||
21
update.py
21
update.py
|
|
@ -1,27 +1,8 @@
|
||||||
import requests
|
|
||||||
from subprocess import run as srun
|
from subprocess import run as srun
|
||||||
import logging, os, dotenv
|
import logging, os
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
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", "")
|
UPSTREAM_REPO = os.environ.get("UPSTREAM_REPO", "")
|
||||||
if len(UPSTREAM_REPO) == 0:
|
if len(UPSTREAM_REPO) == 0:
|
||||||
UPSTREAM_REPO = None
|
UPSTREAM_REPO = None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue