Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
Ilens-Env-Settings
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Irfanuddin
Ilens-Env-Settings
Commits
98f0ee66
Commit
98f0ee66
authored
Mar 09, 2021
by
Irfanuddin
🚴🏽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: Added Read me
parent
7417c7d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
README.md
README.md
+17
-0
ilens_env_settings/__init__.py
ilens_env_settings/__init__.py
+6
-2
No files found.
README.md
0 → 100644
View file @
98f0ee66
# 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>'
)
```
ilens_env_settings/__init__.py
View file @
98f0ee66
...
@@ -53,14 +53,18 @@ class EnvironmentSettings(BaseSettings):
...
@@ -53,14 +53,18 @@ class EnvironmentSettings(BaseSettings):
SECURITY_AGENT_CHECK
:
bool
=
True
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.
The function loads all the environmental variables and makes it available as a class object.
:return: env_settings
:return: env_settings
"""
"""
try
:
try
:
if
use_local
:
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
:
else
:
env_settings
=
EnvironmentSettings
()
env_settings
=
EnvironmentSettings
()
return
env_settings
return
env_settings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment