Browse Source

Add dynaconf for configuration management

jherve 1 năm trước cách đây
mục cha
commit
fd251b215a
5 tập tin đã thay đổi với 18 bổ sung0 xóa
  1. 3 0
      .gitignore
  2. 10 0
      config.py
  3. 1 0
      pyproject.toml
  4. 2 0
      requirements-dev.lock
  5. 2 0
      requirements.lock

+ 3 - 0
.gitignore

@@ -160,3 +160,6 @@ cython_debug/
 #  and can be added to the global gitignore or merged into this file.  For a more nuclear
 #  option (not recommended) you can uncomment the following to ignore the entire idea folder.
 #.idea/
+
+# Ignore dynaconf secret files
+.secrets.*

+ 10 - 0
config.py

@@ -0,0 +1,10 @@
+
+from dynaconf import Dynaconf
+
+settings = Dynaconf(
+    envvar_prefix="DYNACONF",
+    settings_files=['settings.toml', '.secrets.toml'],
+)
+
+# `envvar_prefix` = export envvars with `export DYNACONF_FOO=bar`.
+# `settings_files` = Load these files in the order.

+ 1 - 0
pyproject.toml

@@ -25,6 +25,7 @@ dependencies = [
     "faiss-cpu>=1.8.0",
     "sentencepiece>=0.2.0",
     "protobuf>=5.26.1",
+    "dynaconf>=3.2.5",
 ]
 readme = "README.md"
 requires-python = ">= 3.10"

+ 2 - 0
requirements-dev.lock

@@ -67,6 +67,8 @@ click==8.1.7
 dnspython==2.6.1
     # via email-validator
     # via pymongo
+dynaconf==3.2.5
+    # via de-quoi-parle-le-monde
 email-validator==2.1.1
     # via fastapi
 exceptiongroup==1.2.1

+ 2 - 0
requirements.lock

@@ -67,6 +67,8 @@ click==8.1.7
 dnspython==2.6.1
     # via email-validator
     # via pymongo
+dynaconf==3.2.5
+    # via de-quoi-parle-le-monde
 email-validator==2.1.1
     # via fastapi
 exceptiongroup==1.2.1