Environment Variables
Manage your application's configuration and sensitive data securely with Abasthan's environment variable management.
1. Individual Variables
You can add key-value pairs directly in the "Environment" tab of your service settings. These are injected into your application's process at runtime.
2. Secret Variables
For sensitive information like API keys or database passwords, use Secret Variables. These are encrypted at rest and are never shown in logs or the dashboard after they are set.
3. Environment Groups
If you have multiple services that share the same configuration (e.g., a shared API key), you can create an Environment Group. Any service linked to the group will automatically receive all of its variables.
4. Bulk Import
Use the Import .env File feature to quickly upload multiple variables. Abasthan will parse your .env file and add the variables to your service.
5. File-based Secrets
Some applications require configuration in the form of files (e.g., a google-creds.json). Abasthan allows you to upload these files as File Secrets, which are then mounted into your application's file system at /etc/secrets/.
# Accessing a file secret in Node.js
const fs = require('fs');
const creds = JSON.parse(fs.readFileSync('/etc/secrets/google-creds.json', 'utf8'));