Commit 98f0ee66 authored by Irfanuddin's avatar Irfanuddin 🚴🏽

docs: Added Read me

parent 7417c7d3
# iLens Environment Settings
## How to use?
To get started, ensure you have set system environments or create .env file in your project root.
```python
from ilens_env_settings import get_env_settings
# to load from system env
env_settings = get_env_settings()
# to load from local .env at root
env_settings_local = get_env_settings(use_local=True)
# to load from local .env at different location
env_settings_local_other = get_env_settings(use_local=True, env_file='<path_to_file>')
```
......@@ -53,14 +53,18 @@ class EnvironmentSettings(BaseSettings):
SECURITY_AGENT_CHECK: bool = True
def get_env_settings(use_local=False):
def get_env_settings(use_local=False, env_file='.env'):
"""
The function loads all the environmental variables and makes it available as a class object.
:return: env_settings
"""
try:
if use_local:
env_settings = EnvironmentSettings(_env_file='.env', _env_file_encoding='utf-8', validate_all=False)
env_settings = EnvironmentSettings(
_env_file=env_file,
_env_file_encoding='utf-8',
validate_all=False
)
else:
env_settings = EnvironmentSettings()
return env_settings
......
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