Configuration#
GeoServer CLI uses a flexible configuration system that supports multiple environments and configuration methods.
Configuration Files#
Configuration files live in the configs/ directory and follow the naming convention configs/<name>.config.toml.
Default Configuration#
The default configuration template is configs/default.config.toml:
| |
Creating Custom Configurations#
Create environment-specific configurations:
| |
Edit these files with your environment-specific settings.
Configuration Selection#
Configuration is selected in the following order (highest precedence wins):
- CLI flag:
--configor-c - Environment variable:
GEOSRVCLI_CONFIG - Fallback:
configs/default.config.toml
Using CLI Flag#
| |
Using Environment Variable#
| |
Using direnv (Recommended)#
Create a .envrc file:
| |
Then run:
| |
Environment Variable Overrides#
You can override any configuration setting using environment variables:
| Config Setting | Environment Variable |
|---|---|
base_url | GEOSRVCLI_ENDPOINT |
username | GEOSRVCLI_USERNAME |
password | GEOSRVCLI_PASSWORD |
timeout | GEOSRVCLI_TIMEOUT |
[postgis].host | GEOSRVCLI_POSTGIS_HOST |
[postgis].port | GEOSRVCLI_POSTGIS_PORT |
[postgis].database | GEOSRVCLI_POSTGIS_DATABASE |
[postgis].user | GEOSRVCLI_POSTGIS_USER |
[postgis].password | GEOSRVCLI_POSTGIS_PASSWORD |
[postgis].schema | GEOSRVCLI_POSTGIS_SCHEMA |
[postgis].sslmode | GEOSRVCLI_POSTGIS_SSLMODE |
CLI Flag Overrides#
Global flags can override configuration:
| |
Configuration Precedence#
Settings are resolved in this order (highest to lowest):
- CLI flags (
--base-url,--user, etc.) - Environment variables (
GEOSRVCLI_*) - Configuration file (
configs/*.config.toml) - Default values
Initialize Configuration#
Create a new configuration file:
| |
Validate Configuration#
Check your configuration:
| |
Default Workspace#
Set a default workspace to avoid specifying --workspace in every command:
| |
The CLI will prompt you to persist this setting to .envrc if you use a different workspace.