ha-handler/lib/ha_handler.ex

39 lines
1.2 KiB
Elixir

defmodule HAHandler do
@moduledoc """
This top-level module only contains generic configuration helpers.
"""
# Mix is not available in releases, and these things are static
# anyway (@variables are evaluated at compile time).
@otp_app Mix.Project.config()[:app]
@version Mix.Project.config()[:version]
@env Mix.env()
def http_port, do: Application.get_env(@otp_app, :http_port)
def haproxy_socket, do: Application.get_env(@otp_app, :haproxy_socket)
def pgsql_instances, do: Application.get_env(@otp_app, :pgsql_instances, [])
def drbd_instances, do: Application.get_env(@otp_app, :drbd_instances, [])
def handler_instances, do: Application.get_env(@otp_app, :handler_instances, [])
def acme_challenge_path, do: Application.get_env(@otp_app, :acme_challenge_path)
def static_path(), do: Application.app_dir(@otp_app, "priv/static/")
def otp_app(), do: @otp_app
def version(), do: @version
def env(), do: @env
def acme_challenges_static_config() do
[
at: "/.well-known/acme-challenge/",
from: acme_challenge_path()
]
end
def assets_static_config() do
[
at: "/static",
from: static_path()
]
end
end