diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 67b0c82..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,56 +0,0 @@ -# This file is a template, and might need editing before it works on your project. -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html -# This specific template is located at: -# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml - -# Build a Docker image with CI/CD and push to the GitLab registry. -# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html -# -# This template uses one generic job with conditional builds -# for the default branch and all other (MR) branches. -stages: - - build - -docker-build: - # Use the official docker image. - image: docker:latest - stage: build - services: - - docker:dind - before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - # Default branch leaves tag empty (= latest tag) - # All other branches are tagged with the escaped branch name (commit ref slug) - script: - - | - if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - tag="" - echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - else - tag=":$CI_COMMIT_REF_SLUG" - echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - fi - - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - - docker push "$CI_REGISTRY_IMAGE${tag}" - # Run this job in a branch where a Dockerfile exists - rules: - - if: $CI_COMMIT_BRANCH - exists: - - Dockerfile - -# snap-build-arm64: -# stage: build -# tags: -# - snap-arm64 -# script: -# - snapcraft -# - snapcraft upload --release=edge *.snap -# -# snap-build-amd64: -# stage: build -# tags: -# - snap-amd64 -# script: -# - snapcraft -# - snapcraft upload --release=edge *.snap diff --git a/src/pnut_matrix/appservice.py b/src/pnut_matrix/appservice.py index 70b0481..ca7b863 100644 --- a/src/pnut_matrix/appservice.py +++ b/src/pnut_matrix/appservice.py @@ -8,6 +8,7 @@ import pnutpy import textwrap import time import os +import argparse from mautrix.client import ClientAPI from mautrix.types import * @@ -956,9 +957,12 @@ class MLogFilter(logging.Filter): return True def main(): - configyaml = os.environ.get("CONFIG_FILE") + a_parser = argparse.ArgumentParser() + a_parser.add_argument('-c', '--config', dest='configyaml', + default="config.yaml", help="configuration file") + args = a_parser.parse_args() - with open(configyaml, "rb") as config_file: + with open(args.configyaml, "rb") as config_file: config = yaml.load(config_file, Loader=yaml.SafeLoader) logging.config.dictConfig(config['logging']) diff --git a/src/pnut_matrix/pnutservice.py b/src/pnut_matrix/pnutservice.py index bbbb424..9de0002 100644 --- a/src/pnut_matrix/pnutservice.py +++ b/src/pnut_matrix/pnutservice.py @@ -458,17 +458,11 @@ def main(): global config global matrix_url a_parser = argparse.ArgumentParser() - a_parser.add_argument( - '-d', action='store_true', dest='debug', - help="debug logging" - ) a_parser.add_argument('-c', '--config', dest='configyaml', default="config.yaml", help="configuration file") args = a_parser.parse_args() - configyaml = os.environ.get("CONFIG_FILE") - - with open(configyaml, "rb") as config_file: + with open(args.configyaml, "rb") as config_file: config = yaml.load(config_file, Loader=yaml.SafeLoader) db.init(config['SERVICE_DB'])