Skip to main content

Configure

Marmot can be configured using a YAML configuration file or environment variables.

Configuration File

Default location: ./config.yaml

Example configuration:

database:
host: localhost
port: 5432
user: postgres
password: password
name: marmot
sslmode: disable
maxConns: 10
idleConns: 5
connLifetime: 30
server:
host: 0.0.0.0
port: 8080
logging:
level: info
format: console
auth:
anonymous:
enabled: true
role: user

Configuration Options

Configuration KeyDescriptionDefaultEnvironment Variable
database.hostPostgreSQL hostlocalhostMARMOT_DATABASE_HOST
database.portPostgreSQL port5432MARMOT_DATABASE_PORT
database.userPostgreSQL usernamepostgresMARMOT_DATABASE_USER
database.passwordPostgreSQL password-MARMOT_DATABASE_PASSWORD
database.namePostgreSQL database namemarmotMARMOT_DATABASE_NAME
database.sslmodePostgreSQL SSL modedisableMARMOT_DATABASE_SSLMODE
database.maxConnsMax database connections10MARMOT_DATABASE_MAX_CONNS
database.idleConnsMin idle connections5MARMOT_DATABASE_IDLE_CONNS
database.connLifetimeConnection lifetime (minutes)30MARMOT_DATABASE_CONN_LIFETIME
server.hostServer host0.0.0.0MARMOT_SERVER_HOST
server.portServer port8080MARMOT_SERVER_PORT
logging.levelLog level (debug, info, warn, error)infoMARMOT_LOGGING_LEVEL
logging.formatLog format (json, console)jsonMARMOT_LOGGING_FORMAT
auth.anonymous.enabledEnable anonymous authenticationfalseMARMOT_AUTH_ANONYMOUS_ENABLED
auth.anonymous.roleRole to be assigned to anonymous usersuserMARMOT_AUTH_ANONYMOUS_ROLE

Configuration Loading

Marmot loads configuration in the following order:

  1. Command-line flags (e.g., --config to specify a configuration file)
  2. Configuration sources (exact precedence between environment variables and configuration file may depend on your installation)

Database Configuration

Marmot requires a PostgreSQL database. The connection string is built using the database configuration parameters. Make sure the PostgreSQL user has sufficient privileges to create tables and indexes.

Server Configuration

The server configuration determines the host and port that Marmot listens on. By default, Marmot binds to all interfaces (0.0.0.0) on port 8080.

Logging Configuration

Marmot uses structured logging with configurable levels and formats:

  • Levels: debug, info, warn, error
  • Formats: json, console