EnvCrypt is a Python library designed for managing encrypted environment files. It supports multiple encryption methods, including Base64 and AES, and allows for easy switching between different environments.
To use EnvCrypt, simply import the library and initialize it:
from envcrypt import Env
env = Env("path/to/envfile", encryption_method="AES")
api_key = env.get("API_KEY")
To install EnvCrypt, use the following command:
pip install envcrypt
Retrieve the value of the specified environment variable.
env.get("VARIABLE_NAME")
Remove the specified environment variable and update the file.
env.pop("VARIABLE_NAME")
Set a default value for the environment variable if it does not exist, and update the file.
env.setdefault("VARIABLE_NAME", "default_value")
Switch the current environment to the specified one.
env.switch_environment("development")
Verify the integrity of the environment file using SHA-256 hash.
env.verify_integrity()
List all environment variables in the current environment.
env.list_env()
EnvCrypt هي مكتبة بايثون مصممة لإدارة ملفات البيئة المشفرة. تدعم طرق تشفير متعددة بما في ذلك Base64 و AES، وتسمح بالتبديل بسهولة بين البيئات المختلفة.
لاستخدام EnvCrypt، قم فقط باستيراد المكتبة وتهيئتها:
from envcrypt import Env
env = Env("path/to/envfile", encryption_method="AES")
api_key = env.get("API_KEY")
لتثبيت EnvCrypt، استخدم الأمر التالي:
pip install envcrypt
استرجاع قيمة المتغير البيئي المحدد.
env.get("VARIABLE_NAME")
إزالة المتغير البيئي المحدد وتحديث الملف.
env.pop("VARIABLE_NAME")
تعيين قيمة افتراضية للمتغير البيئي إذا لم يكن موجودًا، وتحديث الملف.
env.setdefault("VARIABLE_NAME", "default_value")
تبديل البيئة الحالية إلى البيئة المحددة.
env.switch_environment("development")
التحقق من سلامة ملف البيئة باستخدام هاش SHA-256.
env.verify_integrity()
عرض جميع المتغيرات البيئية في البيئة الحالية.
env.list_env()