Configuration Options

Complete reference for all Azu configuration options.

Configuring Azu

Azu.configure do |config|
  # Set options here
end

Server Options

port

HTTP server port.

config.port = 8080
  • Type: Int32

  • Default: 4000

  • Environment: PORT

host

Bind address.

config.host = "0.0.0.0"
  • Type: String

  • Default: "0.0.0.0"

  • Environment: HOST

ssl

SSL/TLS configuration.

  • Type: NamedTuple(cert: String, key: String)?

  • Default: nil

  • Environment: SSL_CERT, SSL_KEY

reuse_port

Enable SO_REUSEPORT for multiple processes.

  • Type: Bool

  • Default: false

Environment

env

Application environment.

  • Type: Azu::Environment

  • Default: Development

  • Values: Development, Test, Production

  • Environment: AZU_ENV

Logging

log.level

Log severity level.

  • Type: Log::Severity

  • Default: Debug (development), Info (production)

  • Values: Trace, Debug, Info, Notice, Warn, Error, Fatal

log.backend

Custom log backend.

  • Type: Log::Backend

  • Default: Log::IOBackend.new(STDOUT)

Template Options

template_path

Directory for template files.

  • Type: String

  • Default: "./views"

template_hot_reload

Reload templates on each request.

  • Type: Bool

  • Default: true (development), false (production)

Cache Options

cache

Cache store instance.

  • Type: Azu::Cache::Store

  • Default: Azu::Cache::MemoryStore.new

Router Options

router.path_cache_size

Number of paths to cache.

  • Type: Int32

  • Default: 1000

router.path_cache_enabled

Enable path caching.

  • Type: Bool

  • Default: true

Request Options

max_request_size

Maximum request body size.

  • Type: Int32

  • Default: 8 * 1024 * 1024 (8 MB)

request_timeout

Request timeout.

  • Type: Time::Span

  • Default: 60.seconds

Environment Variables

Azu reads these environment variables:

Variable
Config Option
Description

PORT

port

Server port

HOST

host

Bind address

AZU_ENV

env

Environment

SSL_CERT

ssl.cert

SSL certificate path

SSL_KEY

ssl.key

SSL key path

REDIS_URL

Cache URL

Redis connection

DATABASE_URL

Database

DB connection

Environment-Based Configuration

Complete Example

See Also

Last updated

Was this helpful?