module Azu

Defined in:

azu.cr
azu/cache.cr
azu/channel.cr
azu/component.cr
azu/components/dev_dashboard_component.cr
azu/configuration.cr
azu/content_negotiator.cr
azu/development_tools.cr
azu/environment.cr
azu/error.cr
azu/handler/cors.cr
azu/handler/csrf.cr
azu/handler/dev_dashboard.cr
azu/handler/endpoint.cr
azu/handler/ip_spoofing.cr
azu/handler/logger.cr
azu/handler/performance_monitor.cr
azu/handler/request_id.cr
azu/handler/rescuer.cr
azu/handler/simple_logger.cr
azu/handler/static.cr
azu/handler/throttle.cr
azu/handler_pipeline.cr
azu/log_format.cr
azu/markup.cr
azu/method.cr
azu/params.cr
azu/performance_metrics.cr
azu/performance_reporter.cr
azu/request.cr
azu/response.cr
azu/router.cr
azu/spark.cr
azu/templates.cr

Constant Summary

CONFIG = Configuration.new
ERROR_REPORTER = ErrorReporter.new

Global error reporter instance

Class Method Summary

Class Method Detail

def self.cache #

Rails-like cache API


[View source]
def self.clear_fiber_configs : Nil #

Clear all fiber-local configurations

Useful for cleanup in test suites.


[View source]
def self.current_config : Configuration #

Get the current configuration

Returns fiber-local configuration if set, otherwise returns the global CONFIG. This allows tests to run with isolated configurations without affecting other fibers or the global state.

Example:

# Get current config
current = Azu.current_config
puts current.env # => "development"

[View source]
def self.with_config(config : Configuration, &) #

Execute a block with a custom configuration

This is primarily useful for testing, allowing tests to run with isolated configuration without affecting other tests or the global state.

Example:

test_config = Azu::Configuration.new
test_config.env = Azu::Environment::Test

Azu.with_config(test_config) do
  # Code here uses test_config
  Azu.current_config.env # => Environment::Test
end
# Outside the block, global CONFIG is used again

[View source]