An example AT Protocol application, written in Elixir using atex and Drinkup.
1import Config
2
3# config/runtime.exs is executed for all environments, including
4# during releases. It is executed after compilation and before the
5# system starts, so it is typically used to load production configuration
6# and secrets from environment variables or elsewhere. Do not define
7# any compile-time configuration in here, as it won't be applied.
8# The block below contains prod specific runtime configuration.
9
10# ## Using releases
11#
12# If you use `mix release`, you need to explicitly enable the server
13# by passing the PHX_SERVER=true when you start it:
14#
15# PHX_SERVER=true bin/statusphere start
16#
17# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
18# script that automatically sets the env var above.
19if System.get_env("PHX_SERVER") do
20 config :statusphere, StatusphereWeb.Endpoint, server: true
21end
22
23config :statusphere, StatusphereWeb.Endpoint,
24 http: [port: String.to_integer(System.get_env("PORT", "4000"))]
25
26if config_env() == :prod do
27 database_path =
28 System.get_env("DATABASE_PATH") ||
29 raise """
30 environment variable DATABASE_PATH is missing.
31 For example: /etc/statusphere/statusphere.db
32 """
33
34 config :statusphere, Statusphere.Repo,
35 database: database_path,
36 pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
37
38 # The secret key base is used to sign/encrypt cookies and other secrets.
39 # A default value is used in config/dev.exs and config/test.exs but you
40 # want to use a different value for prod and you most likely don't want
41 # to check this value into version control, so we use an environment
42 # variable instead.
43 secret_key_base =
44 System.get_env("SECRET_KEY_BASE") ||
45 raise """
46 environment variable SECRET_KEY_BASE is missing.
47 You can generate one by calling: mix phx.gen.secret
48 """
49
50 host = System.get_env("PHX_HOST") || "example.com"
51
52 config :statusphere, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
53
54 config :statusphere, StatusphereWeb.Endpoint,
55 url: [host: host, port: 443, scheme: "https"],
56 http: [
57 # Enable IPv6 and bind on all interfaces.
58 # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
59 # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
60 # for details about using IPv6 vs IPv4 and loopback vs public addresses.
61 ip: {0, 0, 0, 0, 0, 0, 0, 0}
62 ],
63 secret_key_base: secret_key_base
64
65 # ## SSL Support
66 #
67 # To get SSL working, you will need to add the `https` key
68 # to your endpoint configuration:
69 #
70 # config :statusphere, StatusphereWeb.Endpoint,
71 # https: [
72 # ...,
73 # port: 443,
74 # cipher_suite: :strong,
75 # keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
76 # certfile: System.get_env("SOME_APP_SSL_CERT_PATH")
77 # ]
78 #
79 # The `cipher_suite` is set to `:strong` to support only the
80 # latest and more secure SSL ciphers. This means old browsers
81 # and clients may not be supported. You can set it to
82 # `:compatible` for wider support.
83 #
84 # `:keyfile` and `:certfile` expect an absolute path to the key
85 # and cert in disk or a relative path inside priv, for example
86 # "priv/ssl/server.key". For all supported SSL configuration
87 # options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
88 #
89 # We also recommend setting `force_ssl` in your config/prod.exs,
90 # ensuring no data is ever sent via http, always redirecting to https:
91 #
92 # config :statusphere, StatusphereWeb.Endpoint,
93 # force_ssl: [hsts: true]
94 #
95 # Check `Plug.SSL` for all available options in `force_ssl`.
96end