From 8ccf4453e1bc0f44efacac96ab4d5b4719921122 Mon Sep 17 00:00:00 2001 From: Marcel Ackermann <31695+dreamflasher@users.noreply.github.com> Date: Tue, 23 Mar 2021 08:30:32 +0100 Subject: [PATCH 1/4] include env config for docker --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebc0d18..fdcae30 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Installing $ pip install -r src/requirements.txt -2. Modify ankisyncd.conf according to your needs +2. Configuration: The config file can be found here: `https://github.com/ankicommunity/anki-sync-server/src/ankisyncd.conf`. Copying the config file from `src/ankisyncd.conf` to `src/ankisyncd/ankisyncd.conf` will allow you to configure the server. Subsequent commands refer to `/anki-sync-server/src/ankisyncd`. 3. Create user: @@ -88,6 +88,16 @@ Installing (Docker) Follow [these instructions](https://github.com/ankicommunity/anki-devops-services#about-this-docker-image). +Configuration: .env.local (Environment variables) +* The environment variables can be found here: config/.env.example. +* The file also includes other development variables, but the notable ones are the ones with the prefix ANKISYNCD_ +* Environment variables will override the config files values (which is why I recommend you use them) +* This is what we use in the Docker images (see: https://github.com/ankicommunity/anki-devops-services/blob/develop/services/anki-sync-server/examples/docker-compose.yml). +* Copying the config file from config/.env.example to config/.env.local will allow you to configure the server when using the make commands +* You can also set it when running the server e.g. ANKISYNCD_PORT=5001 make run +* The above two options are useful for development. But if you're only going for usage, you can also set it globally by adding it to your ~/.bashrc file e.g. export ANKISYNCD_PORT=50001 + + Setting up Anki --------------- From 127c35eec69efd4b8f25c8760482fd3aaa35d896 Mon Sep 17 00:00:00 2001 From: Vikash Kothary Date: Tue, 8 Mar 2022 21:03:05 +0000 Subject: [PATCH 2/4] docs: Move info on environment variables under the appropriate heading --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fdcae30..0a9dc60 100644 --- a/README.md +++ b/README.md @@ -88,15 +88,6 @@ Installing (Docker) Follow [these instructions](https://github.com/ankicommunity/anki-devops-services#about-this-docker-image). -Configuration: .env.local (Environment variables) -* The environment variables can be found here: config/.env.example. -* The file also includes other development variables, but the notable ones are the ones with the prefix ANKISYNCD_ -* Environment variables will override the config files values (which is why I recommend you use them) -* This is what we use in the Docker images (see: https://github.com/ankicommunity/anki-devops-services/blob/develop/services/anki-sync-server/examples/docker-compose.yml). -* Copying the config file from config/.env.example to config/.env.local will allow you to configure the server when using the make commands -* You can also set it when running the server e.g. ANKISYNCD_PORT=5001 make run -* The above two options are useful for development. But if you're only going for usage, you can also set it globally by adding it to your ~/.bashrc file e.g. export ANKISYNCD_PORT=50001 - Setting up Anki --------------- @@ -204,6 +195,14 @@ to the uppercase form of the configuration value. E.g. the environment variable, Environment variables override the values set in the `ankisyncd.conf`. +* The environment variables can be found here: config/.env.example. +* The file also includes other development variables, but the notable ones are the ones with the prefix ANKISYNCD_ +* Environment variables will override the config files values (which is why I recommend you use them) +* This is what we use in the Docker images (see: https://github.com/ankicommunity/anki-devops-services/blob/develop/services/anki-sync-server/examples/docker-compose.yml). +* Copying the config file from config/.env.example to config/.env.local will allow you to configure the server when using the make commands +* You can also set it when running the server e.g. ANKISYNCD_PORT=5001 make run +* The above two options are useful for development. But if you're only going for usage, you can also set it globally by adding it to your ~/.bashrc file e.g. export ANKISYNCD_PORT=50001 + Support for other database backends ----------------------------------- From f0da921f5350b447726b97fa92b833577a14c551 Mon Sep 17 00:00:00 2001 From: Vikash Kothary Date: Tue, 8 Mar 2022 21:05:43 +0000 Subject: [PATCH 3/4] docs: Add command to simplify the process of using config file --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a9dc60..195e75e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,9 @@ Installing $ pip install -r src/requirements.txt -2. Configuration: The config file can be found here: `https://github.com/ankicommunity/anki-sync-server/src/ankisyncd.conf`. Copying the config file from `src/ankisyncd.conf` to `src/ankisyncd/ankisyncd.conf` will allow you to configure the server. Subsequent commands refer to `/anki-sync-server/src/ankisyncd`. +2. Copy the default config file ([ankisyncd.conf](src/ankisyncd.conf)) to configure the server using the command below. Environment variables can be used instead, see: [ENVVAR configuration overrides](#envvar-configuration-overrides). + + $ cp src/ankisyncd.conf src/ankisyncd/. 3. Create user: From ef2086fbbe5a753161ff796927b1ecd7f5baccf5 Mon Sep 17 00:00:00 2001 From: Vikash Kothary Date: Tue, 8 Mar 2022 21:12:35 +0000 Subject: [PATCH 4/4] docs: Add sub-headers for the two types of configuration --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 195e75e..68fddc6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,9 @@ It supports Python 3 and Anki 2.1. - [AnkiDroid](#ankidroid) - [Development](#development) - [Testing](#testing) - - [ENVVAR configuration overrides](#envvar-configuration-overrides) + - [Configuration](#configuration) + - [Environment Variables](#environment-variables-preferred) + - [Config File](#config-file-ankisyncdconf) - [Support for other database backends](#support-for-other-database-backends) @@ -42,7 +44,7 @@ Installing $ pip install -r src/requirements.txt -2. Copy the default config file ([ankisyncd.conf](src/ankisyncd.conf)) to configure the server using the command below. Environment variables can be used instead, see: [ENVVAR configuration overrides](#envvar-configuration-overrides). +2. Copy the default config file ([ankisyncd.conf](src/ankisyncd.conf)) to configure the server using the command below. Environment variables can be used instead, see: [Configuration](#configuration). $ cp src/ankisyncd.conf src/ankisyncd/. @@ -174,7 +176,7 @@ This project uses [GNU Make](https://www.gnu.org/software/make/) to simplify the $ cp config/.env.example config/.env.local ``` -See [ENVVAR configuration overrides](#envvar-configuration-overrides) for more information. +See [Configuration](#configuration) for more information. 2. Download Python dependencies. @@ -188,8 +190,9 @@ $ make init $ make tests ``` -ENVVAR configuration overrides ------------------------------- +## Configuration + +### Environment Variables (preferred) Configuration values can be set via environment variables using `ANKISYNCD_` prepended to the uppercase form of the configuration value. E.g. the environment variable, @@ -205,6 +208,11 @@ Environment variables override the values set in the `ankisyncd.conf`. * You can also set it when running the server e.g. ANKISYNCD_PORT=5001 make run * The above two options are useful for development. But if you're only going for usage, you can also set it globally by adding it to your ~/.bashrc file e.g. export ANKISYNCD_PORT=50001 +### Config File: ankisyncd.conf + +A config file can be used to configuring the server. It can be found here: [src/ankisyncd.conf](src/ankisyncd.conf). + + Support for other database backends -----------------------------------