Skip to content

Commit

Permalink
Use hydra for managing configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
shirte committed Nov 26, 2024
1 parent 783f74b commit 3cf57c8
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,7 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/
.vscode/

# hydra
outputs
1 change: 0 additions & 1 deletion nerdd_backend/settings/__init__.py

This file was deleted.

7 changes: 7 additions & 0 deletions nerdd_backend/settings/channel/kafka.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: kafka
# If env is set to true, try to get the broker url from the environment
# variable KAFKA_BROKER_URL if it is defined. Otherwise (if env is set
# to false or the variable is not defined), use the fallback value below.
env: true
# fallback value:
broker_url: my-cluster-kafka-bootstrap.kafka:9092
1 change: 1 addition & 0 deletions nerdd_backend/settings/channel/memory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: memory
2 changes: 2 additions & 0 deletions nerdd_backend/settings/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
defaults:
- development
1 change: 1 addition & 0 deletions nerdd_backend/settings/db/memory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: "memory"
10 changes: 10 additions & 0 deletions nerdd_backend/settings/db/rethinkdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: rethinkdb
# If env is set to true, the server tries to get host, port and database name from environment
# variables (RETHINKDB_HOST, RETHINKDB_PORT, RETHINKDB_DATABASE). If an environment variable is
# not defined, its fallback value (see below) will be used.
env: true
# If env is set to false (or environment variables are not found), then the following values are
# used:
host: rethinkdb-service.default
port: 28015
database: nerdd
9 changes: 9 additions & 0 deletions nerdd_backend/settings/development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defaults:
- channel: memory
- db: memory

host: localhost
port: 8000

page_size: 5
media_root: ./media
9 changes: 0 additions & 9 deletions nerdd_backend/settings/production.py

This file was deleted.

9 changes: 9 additions & 0 deletions nerdd_backend/settings/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defaults:
- channel: kafka
- db: rethinkdb

host: 0.0.0.0
port: 8000

page_size: 5
media_root: /data
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"python-multipart~=0.0.6",
"aiofiles~=23.2.1",
"looseversion~=1.3.0",
"hydra-core>=1.3.2",
"importlib-resources>=5; python_version<'3.9'",
"importlib-metadata>=4.6; python_version<'3.10'",
]
Expand Down

0 comments on commit 3cf57c8

Please sign in to comment.