
Using Environment Variables and Secrets for Cloud Applications
Published: 2/17/2025
Every application requires configuration. Environment variables including secrets (connection strings, access keys, etc.) provide a mechanism to manage settings for the application to run in different environments (dev, test, stage, prod, etc.).
Consider a serverless function that enables on-the-fly resizing of images to specific dimensions, such as thumbnail, standard or large. Consumer apps place request over an api call.
Functional workflow:
- Read image from a source with some resource ID provided in the request
- Resize image to the desired dimension
- Send the resultant image to a target
Accordingly, the function will require (just a sample; certainly not an exhaustive list!) following environment variables:
STANDARD_THUMBNAIL_WIDTH=150
STANDARD_THUMBNAIL_HEIGHT=150
LARGE_THUMBNAIL_WIDTH=300
LARGE_THUMBNAIL_HEIGHT=300
EMAIL_THUMBNAIL_WIDTH=100
EMAIL_THUMBNAIL_HEIGHT=100
SOURCE_GALLERY=< bucket_name | blob_container_name >
TARGET_GALLERY=< bucket_name | blob_container_name >
Configry.app is a great way to store and use environment variables in a safe and portable manner.