Class: DurableStreams::Rails::ServerConfig
- Inherits:
-
Object
- Object
- DurableStreams::Rails::ServerConfig
- Defined in:
- lib/durable_streams/rails/server_config.rb
Constant Summary collapse
- LOG_FORMATS =
%w[ console json ].freeze
- LOG_LEVELS =
%w[ INFO WARN ERROR DEBUG ].freeze
- STORAGE_DIRECTIVES =
%w[ data_dir max_file_handles long_poll_timeout sse_reconnect_interval ].freeze
- TEMPLATE =
ERB.new(<<~'CADDYFILE', trim_mode: "-") { admin off order jwtauth before basicauth order durable_streams_authorisation after jwtauth <%- unless auto_https? -%> auto_https off <%- end -%> } <%= address %> { <%- if tls_config -%> tls <%= tls_config["cert"] %> <%= tls_config["key"] %> <%- end -%> log { output stderr format <%= log_format %> level <%= log_level %> } respond /up 200 @options { method OPTIONS } <%= route_block %> } <%- if internal -%> :<%= internal["port"] %> { <%- if internal["bind"] -%> bind <%= internal["bind"] %> <%- end -%> @allowed remote_ip <%= internal_allowed_ips.join(" ") %> handle @allowed { reverse_proxy <%= upstream_address %> { <%- if upstream_tls? -%> header_up Host <%= domain %> transport http { tls_server_name <%= domain %> tls_insecure_skip_verify } <%- end -%> } } respond 403 } <%- end -%> CADDYFILE
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(config_path, environment) ⇒ ServerConfig
constructor
A new instance of ServerConfig.
Constructor Details
#initialize(config_path, environment) ⇒ ServerConfig
Returns a new instance of ServerConfig.
66 67 68 69 |
# File 'lib/durable_streams/rails/server_config.rb', line 66 def initialize(config_path, environment) @config = YAML.load_file(config_path, aliases: true).fetch(environment) validate! end |
Class Method Details
.generate(config_path, environment) ⇒ Object
62 63 64 |
# File 'lib/durable_streams/rails/server_config.rb', line 62 def self.generate(config_path, environment) new(config_path, environment).generate end |
Instance Method Details
#generate ⇒ Object
71 72 73 |
# File 'lib/durable_streams/rails/server_config.rb', line 71 def generate TEMPLATE.result(binding) end |