diff --git a/MANIFEST.in b/MANIFEST.in index eb2a1e15..bc783d88 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include *.md include alembic.ini -include config.toml +include dev_config.toml include environment.yml include init_db.py include .flake8 diff --git a/README.md b/README.md index 97f63f68..5703bc57 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ pip install -e . Use the CLI to create a `Quetz` instance: ```bash -quetz run test_quetz --copy-conf ./config.toml --dev --reload +quetz run test_quetz --copy-conf ./dev_config.toml --dev --reload ``` Links: @@ -188,7 +188,7 @@ sudo -u postgres psql -h localhost -c 'CREATE DATABASE quetz OWNER postgres;' ### Deploying Quetz with PostgreSQL backend -Then in your configuration file (such as `config.toml`) replace the `[sqlalchemy]` section with: +Then in your configuration file (such as `dev_config.toml`) replace the `[sqlalchemy]` section with: ```ini [sqlalchemy] diff --git a/config.toml b/config.toml deleted file mode 100644 index ef594291..00000000 --- a/config.toml +++ /dev/null @@ -1,27 +0,0 @@ -[general] -dev = true - -[github] -# Register the app here: https://github.com/settings/applications/new -# Use a callback URL like `http://localhost:8000/auth/github/authorize` -client_id = "37cdbb80c7733e2a1831" -client_secret = "75e648e981545902ab7802de94e2f2707c8e0ff8" - -[sqlalchemy] -database_url = "sqlite:///./quetz.sqlite" - -[session] -# openssl rand -hex 32 -secret = "b72376b88e6f249cb0921052ea8a092381ca17fd8bb0caf4d847e337b3d34cf8" -https_only = false - -[logging] -level = "DEBUG" -file = "quetz.log" - -[users] -admins = ["dummy:alice"] - -[profiling] -enable_sampling = false - diff --git a/docs/source/deploying/configuration.rst b/docs/source/deploying/configuration.rst index 6a2cbf96..1908755b 100644 --- a/docs/source/deploying/configuration.rst +++ b/docs/source/deploying/configuration.rst @@ -8,7 +8,7 @@ Config file Most functionalities of quetz can be configured with a config file in toml format, such as this one: -.. literalinclude:: ../../../config.toml +.. literalinclude:: ../../../dev_config.toml ``sqlalchemy`` section diff --git a/plugins/quetz_content_trust/docs/testing.rst b/plugins/quetz_content_trust/docs/testing.rst index 70630deb..a25b2248 100644 --- a/plugins/quetz_content_trust/docs/testing.rst +++ b/plugins/quetz_content_trust/docs/testing.rst @@ -7,7 +7,7 @@ Few scripts are provided to perform a manual integration test of package signing This is intended to be used by channels owners/maintainers to get familiar with the workflow of generating TUF roles (delegations, etc.) and push them on a Quetz server. For that, simply run the 2 following commands from your quetz source directory: -- `quetz run test_quetz --copy-conf ./config.toml --dev --reload --delete` to get an up and running server +- `quetz run test_quetz --copy-conf ./dev_config.toml --dev --reload --delete` to get an up and running server - `python plugins/quetz_content_trust/docs/test_script.py` to generate TUF roles, push them on the server but also push an empty `test-package` package then just test from client side: `micromamba create -n foo -c http://127.0.0.1:8000/get/channel0 test-package --no-rc -y -vvv --repodata-ttl=0 --experimental --verify-artifacts` diff --git a/quetz/cli.py b/quetz/cli.py index 53bd45ac..a8eea2be 100644 --- a/quetz/cli.py +++ b/quetz/cli.py @@ -393,7 +393,7 @@ def create( ], copy_conf: Annotated[ Optional[str], - typer.Option(help="The configuration to copy from (e.g. config.toml)"), + typer.Option(help="The configuration to copy from (e.g. dev_config.toml)"), ] = None, create_conf: Annotated[ bool, @@ -481,7 +481,7 @@ def create( shutil.copyfile(copy_conf, config_file) if not config_file.exists() and create_conf: - conf = create_config(https=str(config.is_dev() if config else True)) + conf = create_config(https=str(config.is_dev() if config else True).lower()) with open(config_file, "w") as f: f.write(conf) @@ -602,7 +602,7 @@ def run( path: Annotated[str, typer.Argument(help="The path of the deployment")], copy_conf: Annotated[ Optional[str], - typer.Option(help="The configuration to copy from (e.g. config.toml)"), + typer.Option(help="The configuration to copy from (e.g. dev_config.toml)"), ] = None, create_conf: Annotated[ bool, diff --git a/quetz/config.py b/quetz/config.py index b0782030..b627c095 100644 --- a/quetz/config.py +++ b/quetz/config.py @@ -5,6 +5,7 @@ import logging.config import os from distutils.util import strtobool +from pathlib import Path from secrets import token_bytes from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Type, Union @@ -59,7 +60,7 @@ class Config: ConfigSection( "general", [ - ConfigEntry("dev", bool, required=True), + ConfigEntry("dev", bool, required=True, default=False), ConfigEntry("package_unpack_threads", int, 1), ConfigEntry("frontend_dir", str, default=""), ConfigEntry("redirect_http_to_https", bool, False), @@ -244,7 +245,7 @@ def __new__(cls, deployment_config: str = None): return cls._instances[None] try: - path = os.path.abspath(cls.find_file(deployment_config)) + path = str(Path(cls.find_file(deployment_config)).absolute().resolve()) except TypeError: # if not config path exists, set it to empty string. path = "" diff --git a/set_env_dev.sh b/set_env_dev.sh index e52e0089..145e17d2 100755 --- a/set_env_dev.sh +++ b/set_env_dev.sh @@ -1 +1 @@ -export QUETZ_CONFIG_FILE="${PWD}/config.toml" +export QUETZ_CONFIG_FILE="${PWD}/dev_config.toml"