Meh uses a layered configuration system that allows for flexible setup across multiple sites:
-
Default Values: Every configuration option has a sensible default value.
-
Environment Variables: Defaults can be overridden by environment variables prefixed with
MEH_
(e.g., thesite_url
config can be set via theMEH_SITE_URL
env var). -
.env
File: For convenience, you can place environment variables in a.env
file in the project root. The project contains a.env.example
file that you can copy and modify. -
Database Storage: Site-specific configurations can be stored in each site's database and take precedence over environment variables.
When Meh looks for a configuration value, it checks these sources in order:
- Default values (lowest priority)
- Environment variables /
.env
file - Database values (highest priority)
Note: the following options can only be set via the environment or .env
file:
db_path
->MEH_DB_PATH
env
->MEH_ENV
Use the meh config
CLI command to view or modify database configuration values:
# View all configuration values and their sources
./meh config
# View a specific configuration value
./meh config site_url
# Set a configuration value in the database
./meh config site_url https://example.com
# Remove a database configuration (revert to environment or default)
./meh config site_url ""
For multi-site setups, use the --site
parameter:
./meh --site blog1 config site_url https://blog1.example.com
./meh --site blog2 config site_url https://blog2.example.com
Configs set up via Environment always apply to all sites, while configs set up via the database are site-specific.