Modern web applications often depend on external services, databases, APIs, and other integrations. These connections require configuration values such as API keys, database passwords, service tokens, and application settings.
These values are commonly called environment variables or application secrets.
Managing them correctly is important because accidentally publishing a private credential can expose business data, allow unauthorized service usage, or compromise an application.
This guide explains what environment variables are, how to organize application configuration, and how to protect credentials when deploying an application through WebDaddy Pro.
What Are Environment Variables?
Environment variables are configuration values supplied to an application when it runs.
Instead of placing every setting directly inside the source code, developers can separate configuration from the application itself.
Examples include:
-
Database connection details.
-
API keys.
-
External service credentials.
-
Email service settings.
-
Application environment indicators.
-
Authentication secrets.
-
Service endpoint addresses.
An application may read these values from its runtime environment or from a configuration file, depending on how it was developed.
Step 1: Identify the Application's Configuration Requirements
Ask your AI development tool to identify every configuration value the application expects.
Request a list that includes:
-
The variable name.
-
What the variable controls.
-
Whether it contains sensitive information.
-
Whether it is required or optional.
-
Where the application expects to obtain it.
For example, an application may use:
APP_ENV=production
APP_URL=https://yourdomain.com
DB_HOST=your_database_host
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASS=your_database_password
PAYMENT_API_KEY=your_private_api_key
These are illustrative examples. Actual variable names and requirements depend on the application.
Never assume that two applications use the same configuration names.
Step 2: Separate Public Configuration from Private Secrets
Not every configuration value is confidential.
A public website address may be suitable for inclusion in frontend configuration, while a database password or private API key must remain confidential.
Separate values into appropriate categories:
Potentially public configuration
-
Public website address.
-
Public API endpoint.
-
Non-sensitive display preferences.
-
Public application identifiers.
Private configuration
-
Database passwords.
-
Private API keys.
-
Authentication secrets.
-
Payment processor secret keys.
-
Email account passwords.
-
Private service tokens.
Never place private credentials in browser-delivered JavaScript, public HTML, or other files that visitors can download.
A variable name that begins with SECRET, PRIVATE, or API_KEY is not automatically protected. Its actual storage and exposure depend on how the application handles it.
Step 3: Choose a Secure Configuration Method
The correct method depends on your application and hosting environment.
Possible methods include:
-
Environment-variable settings provided by a supported application-management feature.
-
A private configuration file stored outside the publicly accessible website directory.
-
A protected configuration mechanism supported by the application framework.
Do not assume that every hosting service provides the same configuration interface.
If you are unsure where private settings should be stored, confirm the appropriate method with WebDaddy Pro Support before publishing credentials.
Important: A .env filename does not make a file private. If it is stored in a publicly accessible location and the server does not protect it, its contents may be exposed.
Step 4: Configure the Production Values
Production settings should be reviewed separately from development settings.
For each required value:
-
Obtain the correct production value from the service or database it belongs to.
-
Confirm that the value is intended for the production application.
-
Enter it only through the supported configuration method.
-
Check for accidental spaces, missing characters, and incorrect quotation marks.
-
Save the configuration using the method supported by the application.
-
Follow any required application reload or restart procedure.
Do not assume that saving a configuration file automatically reloads an application. The required behavior depends on the application and hosting configuration.
Step 5: Protect and Rotate Exposed Credentials
If a private credential is accidentally published, treat it as compromised.
Recommended actions:
-
Revoke or rotate the exposed credential through the service that issued it.
-
Update the application's private configuration with the replacement.
-
Confirm that the application can still connect to the service.
-
Remove the exposed credential from public locations where possible.
-
Review available activity records for unexpected use.
-
Check whether other credentials were exposed at the same time.
Deleting a credential from the latest version of a public repository does not necessarily remove it from the repository's history or copies that others may have downloaded.
Step 6: Keep Configuration Out of Public Documentation
Avoid including private values in:
-
Screenshots.
-
Tutorials.
-
Public source-code repositories.
-
Support requests.
-
Public troubleshooting pages.
-
Shared project archives.
When requesting assistance, describe the variable names and the error message without including their secret values.
For example, you can report that the database password is being rejected without sending the actual password.
Common Configuration Mistakes
Using development credentials in production
Development and production services should use the correct credentials for their respective environments.
Putting private API keys in frontend code
Anything delivered to a visitor's browser should be treated as potentially visible to that visitor.
Assuming .env files are automatically protected
A filename does not create access restrictions. Storage location and server configuration matter.
Changing credentials without updating the application
A rotated password or API key must also be updated in the application's production configuration.
Sharing secrets with support personnel
Support requests should include relevant technical details, not passwords or private tokens.
Related Deployment Guides
-
How to Deploy an AI-Generated Web Application Without Using a Terminal
-
How to Connect AI-Generated Database Applications to WebDaddy Pro Hosting
Need help determining where application credentials should be configured?
Contact WebDaddy Pro Support. Describe your application framework and configuration requirements. Do not include actual passwords, API keys, or secret tokens.