Commit 9b7632fe authored by Irfanuddin's avatar Irfanuddin 🚴🏽

docs: Added samples

parent 98f0ee66
...@@ -482,7 +482,6 @@ celerybeat.pid ...@@ -482,7 +482,6 @@ celerybeat.pid
*.sage.py *.sage.py
# Environments # Environments
.env
env/ env/
venv/ venv/
ENV/ ENV/
......
...@@ -15,3 +15,15 @@ env_settings_local = get_env_settings(use_local=True) ...@@ -15,3 +15,15 @@ env_settings_local = get_env_settings(use_local=True)
# to load from local .env at different location # to load from local .env at different location
env_settings_local_other = get_env_settings(use_local=True, env_file='<path_to_file>') env_settings_local_other = get_env_settings(use_local=True, env_file='<path_to_file>')
``` ```
`get_env_settings` returns a class object containing all the required environment variables.
To access an environment variable
```python
app_env = env_settings.APP_ENV
# to get all as a dictionary
env_settings.dict()
```
Sample `.env` file:
#ENV
APP_ENV=PROD
#Mongo
MONGO_URI=mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
#Kairos
KAIROS_URI=
#MQTT
MQTT_HOST=
MQTT_PORT=1883
MQTT_AUTH=
MQTT_USERNAME =
MQTT_PASSWORD =
#KAFKA
KAFKA_HOST=
KAFKA_PORT=
#REDIS
REDIS_HOST=
REDIS_PORT=
# Postgres Details
POSTGRES_URI=
#OTHERSERVICES
BASE_PROXY=
SECURITY_IP_CHECK=False
SECURITY_USER_CHECK=True
SECURITY_AGENT_CHECK=True
...@@ -45,7 +45,7 @@ class EnvironmentSettings(BaseSettings): ...@@ -45,7 +45,7 @@ class EnvironmentSettings(BaseSettings):
POSTGRES_URI: Optional[str] POSTGRES_URI: Optional[str]
# Base Proxy for all services # Base Proxy for all services
BASE_PROXY: str BASE_PROXY: Optional[str]
# Security aspects # Security aspects
SECURITY_IP_CHECK: bool = True SECURITY_IP_CHECK: bool = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment