Skip to main content
Grafana provides flexible configuration options through configuration files and environment variables. This allows you to customize Grafana to suit your deployment needs.

Configuration Methods

Grafana can be configured using two primary methods:
  1. Configuration Files - INI-formatted files that define all Grafana settings
  2. Environment Variables - Override any configuration file setting using the GF_<SectionName>_<KeyName> pattern

Configuration File Locations

Grafana uses the following configuration files:
  • conf/defaults.ini - Contains all default settings (do not modify)
  • conf/custom.ini - Your custom configuration overrides
  • Custom path via --config command-line flag

Configuration Priority

Configuration values are applied in the following order (later sources override earlier ones):
  1. Default values from conf/defaults.ini
  2. Custom configuration from conf/custom.ini
  3. Environment variables (prefixed with GF_)
  4. Command-line arguments

Environment Variable Format

All configuration settings can be overridden using environment variables with the following format:
For example:
  • [server] section’s http_port key becomes GF_SERVER_HTTP_PORT
  • [database] section’s type key becomes GF_DATABASE_TYPE
  • [auth.github] section’s client_id key becomes GF_AUTH_GITHUB_CLIENT_ID

Example Configuration

Equivalent environment variables:

Key Configuration Sections

  • [server] - HTTP server settings (protocol, ports, domain)
  • [database] - Database connection configuration
  • [security] - Security settings (admin credentials, secret keys)
  • [auth.*] - Authentication provider settings
  • [smtp] - Email server configuration
  • [paths] - Data, logs, and plugin paths
  • [log] - Logging configuration
  • [dataproxy] - Data source proxy settings

Best Practices

  1. Never modify defaults.ini - Always use custom.ini or environment variables
  2. Use environment variables for secrets - Avoid storing passwords in configuration files
  3. Version control your configuration - Keep custom.ini in version control (excluding secrets)
  4. Document your changes - Add comments to explain custom settings
  5. Test configuration changes - Validate settings in a non-production environment first

Verifying Configuration

After making configuration changes, restart Grafana and check the logs for any errors:

Next Steps

Configuration File

Learn about the INI configuration file format and structure

Environment Variables

Configure Grafana using environment variables

Database Configuration

Set up your database backend

Authentication

Configure authentication providers