Administration/Configuration Files
Environment Configuration
Configure the environment settings for your Gigantics instance. These settings control how the application behaves based on the deployment environment.
Environment Variable
The primary environment configuration is controlled by the NODE_ENV environment variable:
Environment Detection
The application automatically detects the environment and adjusts behavior accordingly:
- Development: Enhanced logging, debugging features enabled
- Production: Optimized performance, minimal logging
- Test: Special test configurations, minimal output
Setting the Environment
Using Environment Variables
Using Command Line
Windows Command Line
Environment-Specific Behaviors
Development Environment
- Default encryption key:
'my-secret-key' - Log level:
'silly' - Enhanced debugging output
- Development SMTP credentials
Production Environment
- Generates secure random encryption key
- Log level:
'http' - Optimized performance settings
- Requires proper SMTP configuration
Test Environment
- Special test configurations
- Log level:
'test' - Isolated test settings
Environment Methods
The application provides methods to check the current environment:
env.isProduction()- Returns true if NODE_ENV is 'production'env.isDevelopment()- Returns true if NODE_ENV is 'development'env.isTest()- Returns true if NODE_ENV is 'test'
Best Practices
- Always Set Environment: Explicitly set NODE_ENV in production
- Environment Consistency: Ensure all application components run in the same environment
- Configuration by Environment: Use different configuration files for different environments
- Security: Never use development settings in production
Testing Environment Configuration
To verify environment configuration:
-
Check current environment:
-
Start application with specific environment:
-
Check logs to verify environment-specific settings are applied
Using Multiple Configuration Files
You can create environment-specific configuration files:
config/default.yaml- Base configurationconfig/development.yaml- Development overridesconfig/production.yaml- Production overridesconfig/test.yaml- Test overrides
Start with specific configuration files: