Skip to content

Configuration

можно. is configured entirely through environment variables. All settings have sensible defaults so you only need to set what differs from the standard setup.

Required Variables

These must be set for the server to start:

VariableDefaultDescription
JWT_SECRETSecret key for signing JWTs. Must be at least 256 bits (32 bytes). Generate with openssl rand -base64 32. Changing this invalidates all existing tokens.

Server Variables

VariableDefaultDescription
SERVER_PORT8080Port the embedded Tomcat server listens on
APP_BASE_URLhttp://localhost:8080Publicly reachable URL of the server. Used for generating links in emails, webhook payloads, and OAuth redirects. Must include protocol (http/https) and no trailing slash.

Database Variables

VariableDefaultDescription
SPRING_DATASOURCE_URLjdbc:postgresql://localhost:5432/feature_flagsJDBC connection URL
SPRING_DATASOURCE_USERNAMEflags_userDatabase username
SPRING_DATASOURCE_PASSWORDflags_passwordDatabase password
HIKARI_MAX_POOL_SIZE20Maximum connections in the HikariCP connection pool. Increase for high-traffic deployments.
HIKARI_MIN_IDLE5Minimum idle connections kept in the pool
HIKARI_CONNECTION_TIMEOUT10000Maximum wait time (ms) for a connection from the pool

JWT & Authentication

VariableDefaultDescription
JWT_SECRETHMAC-SHA256 secret for signing access and refresh tokens
JWT_ACCESS_TOKEN_TTL_MINUTES15Access token lifetime in minutes
JWT_REFRESH_TOKEN_TTL_DAYS30Refresh token lifetime in days

можно. uses JWT authentication with refresh token family rotation. When a refresh token is used, both the old access and refresh tokens are invalidated and new ones are issued. If a stolen (already-revoked) token is presented, the entire token family is revoked — locking out the attacker.

Logging

VariableDefaultDescription
LOGGING_LEVEL_ROOTINFORoot log level. Set to DEBUG for troubleshooting.
LOGGING_LEVEL_DEV_MOZHNOINFOLog level for можно. application code

CORS

VariableDefaultDescription
APP_CORS_ALLOWED_ORIGINS*Comma-separated list of allowed origins for CORS. Set to your frontend origin in production.

Cache & Metrics

VariableDefaultDescription
CACHE_TYPEcaffeineSpring cache type. caffeine — in-memory (default). For Redis add spring-boot-starter-data-redis and set to redis
CACHE_TTL_MINUTES5Cache TTL in minutes
CLIENT_MAX_METRICS_PER_KEY1000Maximum stored metrics entries per client API key

Docker Compose Example

A minimal Docker Compose configuration with all essential variables:

yaml
services:
  postgres:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: feature_flags
      POSTGRES_USER: flags_user
      POSTGRES_PASSWORD: ${DB_PASSWORD}

  mozhno:
    image: ghcr.io/mozhno-dev/mozhno:latest
    ports:
      - '8080:8080'
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/feature_flags
      SPRING_DATASOURCE_USERNAME: flags_user
      SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
      JWT_SECRET: ${JWT_SECRET}
      APP_BASE_URL: https://flags.example.com
      SERVER_PORT: '8080'
      JWT_ACCESS_TOKEN_TTL_MINUTES: '15'
      JWT_REFRESH_TOKEN_TTL_DAYS: '30'
      HIKARI_MAX_POOL_SIZE: '20'
      HIKARI_MIN_IDLE: '5'
      CACHE_TTL_MINUTES: '5'

Production Checklist

  1. Generate a strong JWT_SECRET — use openssl rand -base64 32, never use the default or a predictable value.
  2. Set APP_BASE_URL to your real public URL — incorrect values break OAuth callbacks and webhook delivery.
  3. Restrict APP_CORS_ALLOWED_ORIGINS to your actual frontend domain.
  4. Use environment-specific secrets — never reuse JWT_SECRET across staging and production.
  5. Enable PostgreSQL SSL — append ?ssl=true&sslmode=require to the JDBC URL in production.
  6. Set SERVER_PORT if running behind a reverse proxy on a non-standard port.

SMTP (Email)

VariableDefaultDescription
SMTP_HOSTlocalhostSMTP server host
SMTP_PORT587SMTP server port
SMTP_USERNAMESMTP username
SMTP_PASSWORDSMTP password
EMAIL_FROMnoreply@mozhno.devSender email address

Next Steps

Released under the AGPL v3.0 License.