travel-agent-cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -159,6 +159,14 @@ class Settings(BaseSettings):
|
|
|
159
159
|
@lru_cache()
|
|
160
160
|
def get_settings() -> Settings:
|
|
161
161
|
"""获取配置单例"""
|
|
162
|
+
# 如果 .env 文件不存在,自动从 .env.example 创建
|
|
163
|
+
env_path = Path(__file__).parent.parent / ".env"
|
|
164
|
+
env_example_path = Path(__file__).parent.parent / ".env.example"
|
|
165
|
+
|
|
166
|
+
if not env_path.exists() and env_example_path.exists():
|
|
167
|
+
import shutil
|
|
168
|
+
shutil.copy(env_example_path, env_path)
|
|
169
|
+
|
|
162
170
|
return Settings()
|
|
163
171
|
|
|
164
172
|
|