ha-handler/lib/ha_handler.ex

38 lines
1.1 KiB
Elixir
Raw Normal View History

2022-01-24 14:03:10 +01:00
defmodule HAHandler do
@moduledoc """
This top-level module only contains generic configuration helpers.
"""
2022-01-24 14:03:10 +01:00
# 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)
2022-02-19 10:18:05 +01:00
def pgsql_instances, do: Application.get_env(@otp_app, :pgsql_instances, [])
def drbd_instances, do: Application.get_env(@otp_app, :drbd_instances, [])
2022-02-19 10:18:05 +01:00
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
2022-02-19 11:39:04 +01:00
def acme_challenges_static_config() do
[
at: "/.well-known/acme-challenge/",
from: acme_challenge_path()
]
end
2022-02-19 11:39:04 +01:00
def assets_static_config() do
[
at: "/static",
from: static_path()
]
end
2022-01-24 14:03:10 +01:00
end