Add a cli interface to choose a configuration (#163)

- [x] add a cli to the webserver to take env variables into account 
- [x] add a cli to the data processing that takes enviromental variable
as a valid source into account
- [x] rework the cli for the reset sql command
- [x] rework the cli for the copying of sql data from one db to another
This commit is contained in:
2023-10-02 20:31:42 +02:00
committed by GitHub
parent 2abe12f027
commit d2d4a436f8
22 changed files with 650 additions and 304 deletions

View File

@ -16,8 +16,10 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) about how code should be formatted an
The project has currently the following entrypoint available:
- **data-transfer** > Transfers all the data from the mongodb into the sql db to make it available as production data.
- **data-processing** > Transfers all the data from the mongodb into the sql db to make it available as production data.
- **reset-sql** > Resets all sql tables in the connected db.
- **copy-sql** > Copys the content of a db to another db.
- **webserver** > Starts the webserver showing the analysis results.
## DB Connection settings
@ -26,13 +28,15 @@ To connect to the Mongo db see [connect]
Create a `secrets.json` in the root of this repo with the following structure (values to be replaces by desired config):
The sqlite db is alternative to the postgres section.
```json
{
"postgres": {
"username": "postgres",
"password": "postgres",
"sqlite": "path-to-sqlite.db",
"postgres": {
"username": "username",
"password": "password",
"host": "localhost",
"database": "postgres",
"database": "db-name",
"port": 5432
},
"mongo": {
@ -61,6 +65,8 @@ PYTHON_MONGO_PASSWORD=password
PYTHON_MONGO_PORT=27017
PYTHON_MONGO_DATABASE=transparenzregister
PYTHON_SQLITE_PATH=PathToSQLite3.db # An overwrite path to an sqllite db
PYTHON_DASH_LOGIN_USERNAME=some-login-to-webgui
PYTHON_DASH_LOGIN_PW=some-pw-to-login-to-webgui