2020-10-19 01:01:59 +02:00
|
|
|
# Mobilizon instance configuration
|
|
|
|
|
|
|
|
import Config
|
|
|
|
|
2023-12-07 11:42:19 +01:00
|
|
|
{:ok, _} = Application.ensure_all_started(:tls_certificate_check)
|
|
|
|
|
2023-12-06 16:11:01 +01:00
|
|
|
loglevels = [
|
|
|
|
:emergency,
|
|
|
|
:alert,
|
|
|
|
:critical,
|
|
|
|
:error,
|
|
|
|
:warning,
|
|
|
|
:notice,
|
|
|
|
:info,
|
|
|
|
:debug
|
|
|
|
]
|
|
|
|
|
|
|
|
loglevel_env = System.get_env("MOBILIZON_LOGLEVEL", "error")
|
|
|
|
|
|
|
|
loglevel =
|
|
|
|
if loglevel_env in Enum.map(loglevels, &to_string/1) do
|
|
|
|
String.to_existing_atom(loglevel_env)
|
|
|
|
else
|
|
|
|
:error
|
|
|
|
end
|
|
|
|
|
2021-08-19 10:35:51 +02:00
|
|
|
listen_ip = System.get_env("MOBILIZON_INSTANCE_LISTEN_IP", "0.0.0.0")
|
2021-03-26 11:38:39 +01:00
|
|
|
|
|
|
|
listen_ip =
|
2021-03-30 13:53:47 +02:00
|
|
|
case listen_ip |> to_charlist() |> :inet.parse_address() do
|
2021-03-26 11:38:39 +01:00
|
|
|
{:ok, listen_ip} -> listen_ip
|
|
|
|
_ -> raise "MOBILIZON_INSTANCE_LISTEN_IP does not match the expected IP format."
|
|
|
|
end
|
|
|
|
|
2020-10-19 01:01:59 +02:00
|
|
|
config :mobilizon, Mobilizon.Web.Endpoint,
|
2021-02-01 14:57:58 +01:00
|
|
|
server: true,
|
|
|
|
url: [host: System.get_env("MOBILIZON_INSTANCE_HOST", "mobilizon.lan")],
|
2021-03-26 11:38:39 +01:00
|
|
|
http: [
|
2021-08-19 10:35:51 +02:00
|
|
|
port: String.to_integer(System.get_env("MOBILIZON_INSTANCE_PORT", "4000")),
|
2021-03-26 11:38:39 +01:00
|
|
|
ip: listen_ip
|
|
|
|
],
|
2021-02-01 14:57:58 +01:00
|
|
|
secret_key_base: System.get_env("MOBILIZON_INSTANCE_SECRET_KEY_BASE", "changethis")
|
2020-10-19 01:01:59 +02:00
|
|
|
|
|
|
|
config :mobilizon, Mobilizon.Web.Auth.Guardian,
|
2020-10-22 15:19:01 +02:00
|
|
|
secret_key: System.get_env("MOBILIZON_INSTANCE_SECRET_KEY", "changethis")
|
2020-10-19 01:01:59 +02:00
|
|
|
|
|
|
|
config :mobilizon, :instance,
|
|
|
|
name: System.get_env("MOBILIZON_INSTANCE_NAME", "Mobilizon"),
|
|
|
|
description: "Change this to a proper description of your instance",
|
|
|
|
hostname: System.get_env("MOBILIZON_INSTANCE_HOST", "mobilizon.lan"),
|
2020-10-30 15:14:26 +01:00
|
|
|
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN", "false") == "true",
|
2020-10-19 01:01:59 +02:00
|
|
|
demo: false,
|
|
|
|
allow_relay: true,
|
|
|
|
federating: true,
|
|
|
|
email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL", "noreply@mobilizon.lan"),
|
2020-10-22 15:19:01 +02:00
|
|
|
email_reply_to: System.get_env("MOBILIZON_REPLY_EMAIL", "noreply@mobilizon.lan")
|
2020-10-19 01:01:59 +02:00
|
|
|
|
|
|
|
config :mobilizon, Mobilizon.Storage.Repo,
|
|
|
|
adapter: Ecto.Adapters.Postgres,
|
|
|
|
username: System.get_env("MOBILIZON_DATABASE_USERNAME", "username"),
|
|
|
|
password: System.get_env("MOBILIZON_DATABASE_PASSWORD", "password"),
|
|
|
|
database: System.get_env("MOBILIZON_DATABASE_DBNAME", "mobilizon"),
|
|
|
|
hostname: System.get_env("MOBILIZON_DATABASE_HOST", "postgres"),
|
2022-11-22 09:22:18 +01:00
|
|
|
port: System.get_env("MOBILIZON_DATABASE_PORT", "5432"),
|
2023-04-12 13:34:23 +02:00
|
|
|
ssl: System.get_env("MOBILIZON_DATABASE_SSL", "false") == "true",
|
2020-10-19 01:01:59 +02:00
|
|
|
pool_size: 10
|
|
|
|
|
2023-12-06 16:11:01 +01:00
|
|
|
config :logger, level: loglevel
|
|
|
|
|
2020-10-19 01:01:59 +02:00
|
|
|
config :mobilizon, Mobilizon.Web.Email.Mailer,
|
2022-04-05 12:16:22 +02:00
|
|
|
adapter: Swoosh.Adapters.SMTP,
|
|
|
|
relay: System.get_env("MOBILIZON_SMTP_SERVER", "localhost"),
|
2020-10-22 15:19:01 +02:00
|
|
|
port: System.get_env("MOBILIZON_SMTP_PORT", "25"),
|
|
|
|
username: System.get_env("MOBILIZON_SMTP_USERNAME", nil),
|
|
|
|
password: System.get_env("MOBILIZON_SMTP_PASSWORD", nil),
|
2023-12-06 16:05:33 +01:00
|
|
|
tls: System.get_env("MOBILIZON_SMTP_TLS", "if_available"),
|
2023-12-07 11:42:19 +01:00
|
|
|
tls_options:
|
|
|
|
:tls_certificate_check.options(System.get_env("MOBILIZON_SMTP_SERVER", "localhost")),
|
2023-12-06 16:07:03 +01:00
|
|
|
ssl: System.get_env("MOBILIZON_SMTP_SSL", "false"),
|
2020-10-19 01:01:59 +02:00
|
|
|
retries: 1,
|
|
|
|
no_mx_lookups: false,
|
|
|
|
auth: :if_available
|
2021-02-01 14:57:58 +01:00
|
|
|
|
|
|
|
config :geolix,
|
|
|
|
databases: [
|
|
|
|
%{
|
|
|
|
id: :city,
|
|
|
|
adapter: Geolix.Adapter.MMDB2,
|
|
|
|
source: "/var/lib/mobilizon/geo_db/GeoLite2-City.mmdb"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-11-08 20:27:13 +01:00
|
|
|
config :mobilizon, Mobilizon.Web.Upload.Uploader.Local,
|
|
|
|
uploads: System.get_env("MOBILIZON_UPLOADS", "/var/lib/mobilizon/uploads")
|
|
|
|
|
2021-11-22 19:38:53 +01:00
|
|
|
config :mobilizon, :exports,
|
|
|
|
path: System.get_env("MOBILIZON_UPLOADS_EXPORTS", "/var/lib/mobilizon/uploads/exports"),
|
|
|
|
formats: [
|
|
|
|
Mobilizon.Service.Export.Participants.CSV,
|
|
|
|
Mobilizon.Service.Export.Participants.PDF,
|
|
|
|
Mobilizon.Service.Export.Participants.ODS
|
|
|
|
]
|
|
|
|
|
2021-11-08 20:27:13 +01:00
|
|
|
config :tz_world,
|
|
|
|
data_dir: System.get_env("MOBILIZON_TIMEZONES_DIR", "/var/lib/mobilizon/timezones")
|
2023-04-21 15:49:40 +02:00
|
|
|
|
2023-12-06 16:07:42 +01:00
|
|
|
config :tzdata, :data_dir, System.get_env("MOBILIZON_TZDATA_DIR", "/var/lib/mobilizon/tzdata")
|
2023-12-11 15:59:47 +01:00
|
|
|
|
|
|
|
config :web_push_encryption, :vapid_details,
|
|
|
|
subject: System.get_env("MOBILIZON_WEB_PUSH_ENCRYPTION_SUBJECT", nil),
|
|
|
|
public_key: System.get_env("MOBILIZON_WEB_PUSH_ENCRYPTION_PUBLIC_KEY", nil),
|
|
|
|
private_key: System.get_env("MOBILIZON_WEB_PUSH_ENCRYPTION_PRIVATE_KEY", nil)
|