mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
feat: load environment variables from .env file and update config loading logic
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
This commit is contained in:
parent
5fa0734c66
commit
5ffd3423ff
|
|
@ -0,0 +1,7 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
timezone: "Asia/Shanghai"
|
||||
|
|
@ -184,4 +184,6 @@ data
|
|||
.dev
|
||||
poetry.lock
|
||||
apps/setting/models_provider/impl/*/icon/
|
||||
tmp/
|
||||
tmp/
|
||||
config.yml
|
||||
config.yml
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
#
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from .conf import ConfigManager
|
||||
|
||||
__all__ = ['BASE_DIR', 'PROJECT_DIR', 'VERSION', 'CONFIG']
|
||||
|
|
@ -9,4 +11,12 @@ __all__ = ['BASE_DIR', 'PROJECT_DIR', 'VERSION', 'CONFIG']
|
|||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
PROJECT_DIR = os.path.dirname(BASE_DIR)
|
||||
VERSION = '2.0.0'
|
||||
CONFIG = ConfigManager.load_user_config(root_path=os.path.abspath('/opt/maxkb/conf'))
|
||||
|
||||
# load environment variables from .env file
|
||||
load_dotenv()
|
||||
# print(os.getenv('MAXKB_CONFIG'))
|
||||
if os.getenv('MAXKB_CONFIG') is not None:
|
||||
CONFIG = ConfigManager.load_user_config(root_path=PROJECT_DIR)
|
||||
else:
|
||||
CONFIG = ConfigManager.load_user_config(root_path=os.path.abspath('/opt/maxkb/conf'))
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ readme = "README.md"
|
|||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
django = "^5.2"
|
||||
drf-spectacular = { extras = ["sidecar"], version = "^0.28.0" }
|
||||
django-redis = "^5.4.0"
|
||||
django-db-connection-pool = "^1.2.5"
|
||||
psycopg = {extras = ["binary"], version = "^3.2.6"}
|
||||
|
||||
django = "5.2"
|
||||
drf-spectacular = { extras = ["sidecar"], version = "0.28.0" }
|
||||
django-redis = "5.4.0"
|
||||
django-db-connection-pool = "1.2.5"
|
||||
psycopg = {extras = ["binary"], version = "3.2.6"}
|
||||
python-dotenv = "1.1.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue