Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A Python package to easily work with environment variables, inspired by the method used in Laravel framework to read the .env file.
Persian Immortal Studios presents, A Python package to easily work with environment variables, inspired by the method used in Laravel framework to read the .env
file.
You can install envease
via pip:
pip install envease
if you only want to use a single .env
file where the python file is located then you can import the package like this:
from envease import env
then the usage is gonna be simple:
# inside the .env file
KEY="Hello, World"
print(env('KEY')) # prints the "Hello, World" message
else if you want to use other environment variable files than .env
you can use the package like this:
from envease import *
load_env_file('file_name')
print('KEY') # this prints the value inside the 'KEY' inside the 'file_name' file
you can even dynamically call different environment variable files
from envease import *
env_files = {
"first": ".first.env",
"second": ".second.env",
"third": ".third.env",
}
load_multiple(env_files)
print(dynamic_env('first', 'KEY')) # this will print the value addressed with 'KEY' inside the .first.env file
Notice: you can as well handle default values if the returned value is null!
print('KEY', 'default value') # this prints the value addressed with 'KEY' inside the environment variables. if it was null it will print 'default value' as a string
print(dynamic_env('first', 'KEY'), 'default value') # this prints the value addressed with 'KEY' inside the environment variables addressed with 'first' key in the dictionary. if it was null it will print 'default value' as a string
Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A Python package to easily work with environment variables, inspired by the method used in Laravel framework to read the .env file.
We found that envease demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.