Move configuration to traditional way
⭐️ This is the way. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -10,15 +10,15 @@ config :mobilizon,
|
||||
ecto_repos: [Mobilizon.Storage.Repo],
|
||||
env: Mix.env()
|
||||
|
||||
config :mobilizon, Mobilizon.Storage.Repo, types: Mobilizon.Storage.PostgresTypes
|
||||
|
||||
config :mobilizon, :instance,
|
||||
name: System.get_env("MOBILIZON_INSTANCE_NAME") || "My Mobilizon Instance",
|
||||
description:
|
||||
System.get_env("MOBILIZON_INSTANCE_DESCRIPTION") ||
|
||||
"Change this to a proper description of your instance",
|
||||
hostname: System.get_env("MOBILIZON_INSTANCE_HOST") || "localhost",
|
||||
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") || false,
|
||||
name: "My Mobilizon Instance",
|
||||
description: "Change this to a proper description of your instance",
|
||||
hostname: "localhost",
|
||||
registrations_open: false,
|
||||
registration_email_whitelist: [],
|
||||
demo: System.get_env("MOBILIZON_INSTANCE_DEMO_MODE") || false,
|
||||
demo: false,
|
||||
repository: Mix.Project.config()[:source_url],
|
||||
allow_relay: true,
|
||||
# Federation is to be activated with Mobilizon 1.0.0-beta.2
|
||||
@@ -27,8 +27,8 @@ config :mobilizon, :instance,
|
||||
upload_limit: 10_000_000,
|
||||
avatar_upload_limit: 2_000_000,
|
||||
banner_upload_limit: 4_000_000,
|
||||
email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL") || "noreply@localhost",
|
||||
email_reply_to: System.get_env("MOBILIZON_INSTANCE_EMAIL") || "noreply@localhost"
|
||||
email_from: "noreply@localhost",
|
||||
email_reply_to: "noreply@localhost"
|
||||
|
||||
config :mime, :types, %{
|
||||
"application/activity+json" => ["activity-json"],
|
||||
@@ -37,10 +37,17 @@ config :mime, :types, %{
|
||||
|
||||
# Configures the endpoint
|
||||
config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
url: [host: "localhost"],
|
||||
http: [
|
||||
transport_options: [socket_opts: [:inet6]]
|
||||
],
|
||||
url: [
|
||||
host: "mobilizon.local",
|
||||
scheme: "https"
|
||||
],
|
||||
secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM",
|
||||
render_errors: [view: Mobilizon.Web.ErrorView, accepts: ~w(html json)],
|
||||
pubsub: [name: Mobilizon.PubSub, adapter: Phoenix.PubSub.PG2]
|
||||
pubsub: [name: Mobilizon.PubSub, adapter: Phoenix.PubSub.PG2],
|
||||
cache_static_manifest: "priv/static/manifest.json"
|
||||
|
||||
# Upload configuration
|
||||
config :mobilizon, Mobilizon.Web.Upload,
|
||||
@@ -73,14 +80,31 @@ config :mobilizon, :media_proxy,
|
||||
]
|
||||
]
|
||||
|
||||
config :mobilizon, Mobilizon.Web.Email.Mailer,
|
||||
adapter: Bamboo.SMTPAdapter,
|
||||
server: "localhost",
|
||||
hostname: "localhost",
|
||||
port: 25,
|
||||
# or {:system, "SMTP_USERNAME"}
|
||||
username: nil,
|
||||
# or {:system, "SMTP_PASSWORD"}
|
||||
password: nil,
|
||||
# can be `:always` or `:never`
|
||||
tls: :if_available,
|
||||
# or {":system", ALLOWED_TLS_VERSIONS"} w/ comma seprated values (e.g. "tlsv1.1,tlsv1.2")
|
||||
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
|
||||
# can be `true`
|
||||
ssl: false,
|
||||
retries: 1,
|
||||
# can be `true`
|
||||
no_mx_lookups: false
|
||||
|
||||
# Configures Elixir's Logger
|
||||
config :logger, :console,
|
||||
format: "$time $metadata[$level] $message\n",
|
||||
metadata: [:request_id]
|
||||
|
||||
config :mobilizon, Mobilizon.Web.Auth.Guardian,
|
||||
issuer: "mobilizon",
|
||||
secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo"
|
||||
config :mobilizon, Mobilizon.Web.Auth.Guardian, issuer: "mobilizon"
|
||||
|
||||
config :guardian, Guardian.DB,
|
||||
repo: Mobilizon.Storage.Repo,
|
||||
@@ -96,7 +120,7 @@ config :geolix,
|
||||
%{
|
||||
id: :city,
|
||||
adapter: Geolix.Adapter.MMDB2,
|
||||
source: System.get_env("GEOLITE_CITIES_PATH") || "priv/data/GeoLite2-City.mmdb"
|
||||
source: "priv/data/GeoLite2-City.mmdb"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -124,36 +148,31 @@ config :http_signatures,
|
||||
|
||||
config :mobilizon, :activitypub, sign_object_fetches: true
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Nominatim,
|
||||
endpoint:
|
||||
System.get_env("GEOSPATIAL_NOMINATIM_ENDPOINT") || "https://nominatim.openstreetmap.org",
|
||||
api_key: System.get_env("GEOSPATIAL_NOMINATIM_API_KEY") || nil
|
||||
endpoint: "https://nominatim.openstreetmap.org",
|
||||
api_key: nil
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Addok,
|
||||
endpoint: System.get_env("GEOSPATIAL_ADDOK_ENDPOINT") || "https://api-adresse.data.gouv.fr"
|
||||
endpoint: "https://api-adresse.data.gouv.fr"
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Photon,
|
||||
endpoint: System.get_env("GEOSPATIAL_PHOTON_ENDPOINT") || "https://photon.komoot.de"
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Photon, endpoint: "https://photon.komoot.de"
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.GoogleMaps,
|
||||
api_key: System.get_env("GEOSPATIAL_GOOGLE_MAPS_API_KEY") || nil,
|
||||
fetch_place_details: System.get_env("GEOSPATIAL_GOOGLE_MAPS_FETCH_PLACE_DETAILS") || true
|
||||
api_key: nil,
|
||||
fetch_place_details: true
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.MapQuest,
|
||||
api_key: System.get_env("GEOSPATIAL_MAP_QUEST_API_KEY") || nil
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.MapQuest, api_key: nil
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Mimirsbrunn,
|
||||
endpoint: System.get_env("GEOSPATIAL_MIMIRSBRUNN_ENDPOINT") || nil
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Mimirsbrunn, endpoint: nil
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Pelias,
|
||||
endpoint: System.get_env("GEOSPATIAL_PELIAS_ENDPOINT") || nil
|
||||
config :mobilizon, Mobilizon.Service.Geospatial.Pelias, endpoint: nil
|
||||
|
||||
config :mobilizon, :maps,
|
||||
tiles: [
|
||||
endpoint:
|
||||
System.get_env("MAPS_TILES_ENDPOINT") ||
|
||||
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
attribution: System.get_env("MAPS_TILES_ATTRIBUTION")
|
||||
endpoint: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
attribution: "© The OpenStreetMap Contributors"
|
||||
]
|
||||
|
||||
config :mobilizon, :anonymous,
|
||||
|
||||
@@ -8,10 +8,10 @@ import Config
|
||||
# with brunch.io to recompile .js and .css sources.
|
||||
config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
http: [
|
||||
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000
|
||||
port: 4000
|
||||
],
|
||||
url: [
|
||||
host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.local",
|
||||
host: System.get_env("MOBILIZON_INSTANCE_HOST", "mobilizon.local"),
|
||||
port: 80,
|
||||
scheme: "http"
|
||||
],
|
||||
@@ -65,13 +65,36 @@ config :mobilizon, Mobilizon.Web.Email.Mailer, adapter: Bamboo.LocalAdapter
|
||||
|
||||
# Configure your database
|
||||
config :mobilizon, Mobilizon.Storage.Repo,
|
||||
types: Mobilizon.Storage.PostgresTypes,
|
||||
username: System.get_env("MOBILIZON_DATABASE_USERNAME") || "mobilizon",
|
||||
password: System.get_env("MOBILIZON_DATABASE_PASSWORD") || "mobilizon",
|
||||
database: System.get_env("MOBILIZON_DATABASE_DBNAME") || "mobilizon_dev",
|
||||
hostname: System.get_env("MOBILIZON_DATABASE_HOST") || "localhost",
|
||||
port: System.get_env("MOBILIZON_DATABASE_PORT") || "5432",
|
||||
username: System.get_env("MOBILIZON_DATABASE_USERNAME", "mobilizon"),
|
||||
password: System.get_env("MOBILIZON_DATABASE_PASSWORD", "mobilizon"),
|
||||
database: System.get_env("MOBILIZON_DATABASE_DBNAME", "mobilizon_dev"),
|
||||
hostname: System.get_env("MOBILIZON_DATABASE_HOST", "localhost"),
|
||||
port: "5432",
|
||||
pool_size: 10,
|
||||
show_sensitive_data_on_connection_error: true
|
||||
|
||||
config :mobilizon, :instance,
|
||||
name: System.get_env("MOBILIZON_INSTANCE_NAME", "Mobilizon"),
|
||||
hostname: System.get_env("MOBILIZON_INSTANCE_HOST", "Mobilizon"),
|
||||
email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL"),
|
||||
email_reply_to: System.get_env("MOBILIZON_INSTANCE_EMAIL"),
|
||||
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") == "true"
|
||||
|
||||
config :mobilizon, :activitypub, sign_object_fetches: false
|
||||
|
||||
require Logger
|
||||
|
||||
cond do
|
||||
System.get_env("INSTANCE_CONFIG") &&
|
||||
File.exists?("./config/#{System.get_env("INSTANCE_CONFIG")}") ->
|
||||
import_config System.get_env("INSTANCE_CONFIG")
|
||||
|
||||
System.get_env("DOCKER", "false") == "false" && File.exists?("./config/dev.secret.exs") ->
|
||||
import_config "dev.secret.exs"
|
||||
|
||||
System.get_env("DOCKER", "false") == "true" ->
|
||||
Logger.info("Using environment configuration for Docker")
|
||||
|
||||
true ->
|
||||
Logger.error("No configuration file found")
|
||||
end
|
||||
|
||||
@@ -2,86 +2,26 @@ import Config
|
||||
|
||||
config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
http: [
|
||||
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000,
|
||||
transport_options: [socket_opts: [:inet6]]
|
||||
port: 4000
|
||||
],
|
||||
url: [
|
||||
host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.me",
|
||||
port: 443,
|
||||
scheme: "https"
|
||||
],
|
||||
secret_key_base:
|
||||
System.get_env("MOBILIZON_SECRET") || "ThisShouldBeAVeryStrongStringPleaseReplaceMe",
|
||||
cache_static_manifest: "priv/static/manifest.json"
|
||||
|
||||
# Configure your database
|
||||
config :mobilizon, Mobilizon.Storage.Repo,
|
||||
types: Mobilizon.Storage.PostgresTypes,
|
||||
username: System.get_env("MOBILIZON_DATABASE_USERNAME") || "mobilizon",
|
||||
password: System.get_env("MOBILIZON_DATABASE_PASSWORD") || "mobilizon",
|
||||
database: System.get_env("MOBILIZON_DATABASE_DBNAME") || "mobilizon_prod",
|
||||
hostname: System.get_env("MOBILIZON_DATABASE_HOST") || "localhost",
|
||||
port: System.get_env("MOBILIZON_DATABASE_PORT") || "5432",
|
||||
pool_size: 15
|
||||
|
||||
config :mobilizon, Mobilizon.Web.Email.Mailer,
|
||||
adapter: Bamboo.SMTPAdapter,
|
||||
server: "localhost",
|
||||
hostname: "localhost",
|
||||
port: 25,
|
||||
# or {:system, "SMTP_USERNAME"}
|
||||
username: nil,
|
||||
# or {:system, "SMTP_PASSWORD"}
|
||||
password: nil,
|
||||
# can be `:always` or `:never`
|
||||
tls: :if_available,
|
||||
# or {":system", ALLOWED_TLS_VERSIONS"} w/ comma seprated values (e.g. "tlsv1.1,tlsv1.2")
|
||||
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
|
||||
# can be `true`
|
||||
ssl: false,
|
||||
retries: 1,
|
||||
# can be `true`
|
||||
no_mx_lookups: false
|
||||
host: "mobilizon.local",
|
||||
scheme: "https",
|
||||
port: 443
|
||||
]
|
||||
|
||||
# Do not print debug messages in production
|
||||
config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info
|
||||
config :logger, level: :info
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim
|
||||
cond do
|
||||
System.get_env("INSTANCE_CONFIG") &&
|
||||
File.exists?("./config/#{System.get_env("INSTANCE_CONFIG")}") ->
|
||||
import_config System.get_env("INSTANCE_CONFIG")
|
||||
|
||||
# ## SSL Support
|
||||
#
|
||||
# To get SSL working, you will need to add the `https` key
|
||||
# to the previous section and set your `:url` port to 443:
|
||||
#
|
||||
# config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
# ...
|
||||
# url: [host: "example.com", port: 443],
|
||||
# https: [:inet6,
|
||||
# port: 443,
|
||||
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
|
||||
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
|
||||
#
|
||||
# Where those two env variables return an absolute path to
|
||||
# the key and cert in disk or a relative path inside priv,
|
||||
# for example "priv/ssl/server.key".
|
||||
#
|
||||
# We also recommend setting `force_ssl`, ensuring no data is
|
||||
# ever sent via http, always redirecting to https:
|
||||
#
|
||||
# config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
# force_ssl: [hsts: true]
|
||||
#
|
||||
# Check `Plug.SSL` for all available options in `force_ssl`.
|
||||
File.exists?("./config/dev.secret.exs") ->
|
||||
import_config "dev.secret.exs"
|
||||
|
||||
# ## Using releases
|
||||
#
|
||||
# If you are doing OTP releases, you need to instruct Phoenix
|
||||
# to start the server for all endpoints:
|
||||
#
|
||||
# config :phoenix, :serve_endpoints, true
|
||||
#
|
||||
# Alternatively, you can configure exactly which server to
|
||||
# start per endpoint:
|
||||
#
|
||||
# config :mobilizon, Mobilizon.Web.Endpoint, server: true
|
||||
#
|
||||
true ->
|
||||
require Logger
|
||||
Logger.error("No configuration file found")
|
||||
end
|
||||
|
||||
@@ -8,11 +8,13 @@ config :mobilizon, :instance,
|
||||
# you can enable the server option below.
|
||||
config :mobilizon, Mobilizon.Web.Endpoint,
|
||||
http: [
|
||||
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 80
|
||||
port: 80
|
||||
],
|
||||
url: [
|
||||
host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.test"
|
||||
host: "mobilizon.test",
|
||||
scheme: "http"
|
||||
],
|
||||
secret_key_base: "some secret",
|
||||
server: false
|
||||
|
||||
# Print only warnings and errors during test
|
||||
@@ -26,7 +28,7 @@ config :logger,
|
||||
# Configure your database
|
||||
config :mobilizon, Mobilizon.Storage.Repo,
|
||||
types: Mobilizon.Storage.PostgresTypes,
|
||||
username: System.get_env("MOBILIZON_DATABASE_USERNAME") || "mobilizon",
|
||||
username: System.get_env("MOBILIZON_DATABASE_USERNAME") || "mobilizon_test",
|
||||
password: System.get_env("MOBILIZON_DATABASE_PASSWORD") || "mobilizon",
|
||||
database: System.get_env("MOBILIZON_DATABASE_DBNAME") || "mobilizon_test",
|
||||
hostname: System.get_env("MOBILIZON_DATABASE_HOST") || "localhost",
|
||||
@@ -44,3 +46,9 @@ config :exvcr,
|
||||
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Mock
|
||||
|
||||
config :mobilizon, Oban, queues: false, prune: :disabled
|
||||
|
||||
config :mobilizon, Mobilizon.Web.Auth.Guardian, secret_key: "some secret"
|
||||
|
||||
if System.get_env("DOCKER", "false") == "false" && File.exists?("./config/test.secret.exs") do
|
||||
import_config "test.secret.exs"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user