mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 19:14:51 +00:00
Fix updater
This commit is contained in:
parent
30f151a565
commit
f62bd5fa53
2 changed files with 20 additions and 20 deletions
|
|
@ -1,28 +1,9 @@
|
||||||
import sys, requests
|
import sys, requests
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from os import environ
|
from os import environ
|
||||||
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,8 +1,27 @@
|
||||||
from subprocess import run as srun
|
from subprocess import run as srun
|
||||||
import logging, os
|
import logging, os, requests
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
load_dotenv("config.env", override=True)
|
||||||
|
|
||||||
UPSTREAM_REPO_URL = os.environ.get("UPSTREAM_REPO_URL", "")
|
UPSTREAM_REPO_URL = os.environ.get("UPSTREAM_REPO_URL", "")
|
||||||
if len(UPSTREAM_REPO_URL) == 0:
|
if len(UPSTREAM_REPO_URL) == 0:
|
||||||
UPSTREAM_REPO_URL = None
|
UPSTREAM_REPO_URL = None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue