Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [Config] Detect/Copy/Download config.yml from config.yml.template #2378

Merged
merged 12 commits into from
Jan 6, 2025
Prev Previous commit
Next Next commit
Update error wordings to be more consistent
YozoraXCII committed Dec 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e95046a4d6dcf10db6019b9777fb83677c8268f0
10 changes: 5 additions & 5 deletions kometa.py
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ def get_env(env_str, default, arg_bool=False, arg_int=False):
if run_args["config"] and os.path.exists(run_args["config"]):
default_dir = os.path.join(os.path.dirname(os.path.abspath(run_args["config"])))
elif run_args["config"] and not os.path.exists(run_args["config"]):
print(f"Config Error: config not found at {os.path.abspath(run_args['config'])}")
print(f"Config Error: Configuration file (config.yml) not found at {os.path.abspath(run_args['config'])}")
sys.exit(0)
elif not os.path.exists(os.path.join(default_dir, "config.yml")):
template_path = os.path.join(default_dir, "config.yml.template")
@@ -206,11 +206,11 @@ def get_env(env_str, default, arg_bool=False, arg_int=False):
print(f"Configuration file (config.yml) created at {config_path}. Please open this file and update it with your API keys etc.")
sys.exit(1)
except Exception as e:
print(f"Error: Unable to copy the configuration template file from {template_path} to {config_path}. Details: {e}")
print(f"Config Error: Unable to copy the Template file (config.yml.template) from {template_path} to {config_path}. Details: {e}")
sys.exit(1)
else:
if git_branch:
github_url = f"https://raw.githubusercontent.com/Kometa-Team/Kometa/{git_branch}/config/config.yml.template"
github_url = f"https://raw.githubusercontent.com/Kometa-Team/Kometa/bob/config/config.yml.template"
try:
response = requests.get(github_url, timeout=10)
if response.status_code == 200:
@@ -221,10 +221,10 @@ def get_env(env_str, default, arg_bool=False, arg_int=False):
print(f"A Configuration file (config.yml) has been downloaded from GitHub and saved as {config_path}. Please update this file with your API keys and other required settings.")
sys.exit(1)
else:
print(f"Error: No Configuration file (config.yml) found locally, and the template file(config.yml.template) could not be downloaded from GitHub. Please visit the GitHub repository to manually download the config.yml.template file.")
print(f"Config Error: No Configuration file (config.yml) or Template file (config.yml.template) found in the config path, and the template file(config.yml.template) could not be downloaded from GitHub. Please visit the GitHub repository to manually download the config.yml.template file and place it in {template_path} prior to running Kometa again. ")
sys.exit(1)
except requests.RequestException as e:
print(f"Error: Failed to download the configuration template file (config.yml.template) from GitHub. Details: {e}")
print(f"Config Error: Failed to download the configuration template file (config.yml.template) from GitHub. Details: {e}")
sys.exit(1)
else:
print(

Unchanged files with check annotations Beta

FROM python:3.11-slim-buster
ARG BRANCH_NAME=master
ENV BRANCH_NAME ${BRANCH_NAME}

Check warning on line 3 in Dockerfile

GitHub Actions / docker-build-pull

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV TINI_VERSION v0.19.0

Check warning on line 4 in Dockerfile

GitHub Actions / docker-build-pull

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV KOMETA_DOCKER True

Check warning on line 5 in Dockerfile

GitHub Actions / docker-build-pull

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
COPY requirements.txt requirements.txt
RUN echo "**** install system packages ****" \
&& apt-get update \