Application Configuration

Firmiana is configured via src/main/resources/application.yml.

Complete Configuration Reference

micronaut:
  application:
    name: firmiana
  server:
    port: 8899                    # HTTP server port
    cors:
      enabled: true
      configurations:
        web:
          allowed-origins-regex: .*   # WARNING: Restrict in production
          allowed-methods: [POST, PUT, GET, DELETE, OPTIONS]
          allowed-headers: [Content-Type, Authorization, X-Requested-With]
          expose-headers: [Content-Type, Authorization]
          allow-credentials: false

  security:
    enabled: true
    authentication: bearer
    token:
      name: Authorization
      jwt:
        enabled: true            # Note: Matrix auth uses opaque tokens, not JWT
        signatures:
          secret:
            default:
              secret: ${JWT_SECRET:...}

# Matrix homeserver settings
matrix:
  client:
    support:
      email-address: admin@localhost
      role: m.role.admin
  homeserver:
    base-url: http://localhost:8899
  identity-server:
    base-url: http://localhost:8899
  identity:
    mode: disabled               # disabled | embedded | proxy

# Rate limiting
rate-limit:
  enabled: true
  max-requests-per-window: 100
  window-ms: 60000

# H2 Database
h2:
  enabled: true
  mode: file
  path: ./data/matrix
  pool-size: 10
  max-lifetime: 1800000
  web-console: false
  schema-initializer:
    enabled: false               # Use Flyway instead

# Datasource
datasources:
  default:
    url: ${DB_URL:jdbc:h2:./data/matrix;DB_CLOSE_DELAY=-1}
    driver-class-name: org.h2.Driver
    username: ${DB_USERNAME:sa}
    password: ${DB_PASSWORD:}
    schema-generate: NONE
    dialect: H2

# Flyway migrations
flyway:
  datasources:
    default:
      enabled: true
      locations: classpath:db/migration
      baseline-on-migrate: true

# Security headers
security-headers:
  content-security-policy: "default-src 'self'"
  x-content-type-options: nosniff
  x-frame-options: DENY
  strict-transport-security: "max-age=31536000; includeSubDomains"

Configuration Sections

Server

PropertyDefaultDescription
micronaut.server.port8899HTTP port
micronaut.server.cors.enabledtrueEnable CORS
micronaut.server.cors.configurations.web.allowed-origins-regex.*CORS origin regex

Security

PropertyDefaultDescription
micronaut.security.enabledtrueEnable security
micronaut.security.authenticationbearerAuth method
micronaut.security.token.jwt.enabledtrueJWT integration (not used for Matrix auth)

Matrix

PropertyDefaultDescription
matrix.homeserver.base-urlhttp://localhost:8899Server public URL
matrix.identity.modedisabledIdentity service mode
matrix.identity.base-url""Identity service URL

Rate Limiting

PropertyDefaultDescription
rate-limit.enabledtrueEnable rate limiting
rate-limit.max-requests-per-window100Max requests per window
rate-limit.window-ms60000Window duration in ms

Database

PropertyDefaultDescription
h2.enabledtrueEnable H2
h2.modefilefile or mem
h2.path./data/matrixDatabase file path
h2.pool-size10Connection pool size
flyway.datasources.default.enabledtrueEnable Flyway