mirror of
https://github.com/ClaperCo/Claper.git
synced 2026-09-01 19:49:11 +02:00
commit 705ea00064e552f482bff52c3c5b11d23fbd5b4c Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 21 10:08:42 2024 -0500 Change version commit 330173bd64bb18c5ea7e68a2122f66497981c3c3 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 21 10:01:52 2024 -0500 Fix layout commit 3cc075962e961f8a78b0c30eca9b79db6b9a5731 Author: Alex Lion <dev@alexandrelion.com> Date: Thu Dec 19 14:20:59 2024 +0100 Update changelog commit 63b1fa7ee591d40e44005b7939f51c99cf3e119e Author: Alex Lion <dev@alexandrelion.com> Date: Sun Dec 15 18:56:01 2024 +0100 Fix upper commit 8e7bb1990c58e343de5aa18036eb0916573fb4c6 Author: Alex Lion <dev@alexandrelion.com> Date: Sun Dec 15 18:49:20 2024 +0100 Add pagination for events commit 28beacd120f0a1081e670e4a06bbc185cc699beb Author: Alex Lion <dev@alexandrelion.com> Date: Mon Dec 9 21:03:13 2024 +0100 Add pagination commit c79d6cce947869b98795b9baf541a32952624969 Author: Alex Lion <dev@alexandrelion.com> Date: Sun Dec 8 21:24:23 2024 +0100 Fix tests commit caad25ad75b5937ca0906dca89dedaa4d58ae072 Author: Alex Lion <dev@alexandrelion.com> Date: Sun Dec 8 17:43:55 2024 +0100 Fix user registration bug commit 38c3eecc49d1397a8bb7a4a11203775396d00272 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 7 22:23:24 2024 +0100 Update changelog commit e648ef08a0f61cf4b554fcbf0a83e02a2249de0d Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 7 22:06:27 2024 +0100 Add obin commit 6925117818e117dbd60efea5ae6c81a26a57f76f Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 7 19:39:03 2024 +0100 WIP commit be9b2886d3b879452f5bae08b3cdd181cac254f8 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Dec 7 16:19:09 2024 +0100 Add LTI AGS for quizzes commit 29a7c96de6d4e38b26dfaa61bfa5e689a16d4935 Author: Alex Lion <dev@alexandrelion.com> Date: Thu Dec 5 13:30:49 2024 +0100 Add translations commit 249fdc9188c7613a6adafb0b983303c1ae7601bd Author: Alex Lion <dev@alexandrelion.com> Date: Tue Dec 3 21:37:27 2024 +0100 Add qti export commit c2d56e30cdb6c629e957c64e4393dfd9d5af7159 Author: Alex Lion <dev@alexandrelion.com> Date: Tue Dec 3 20:44:58 2024 +0100 Fix report embed commit a34c239f9014e53b079106f1935bc2b079d01eed Author: Alex Lion <dev@alexandrelion.com> Date: Sat Nov 30 11:32:32 2024 +0100 Add export quiz commit 8d1f34b90635776ae40849bd75fd135693b116fb Author: Alex Lion <dev@alexandrelion.com> Date: Sat Nov 30 00:56:50 2024 +0100 Improve design commit d9a7370419ed9e288eccf263c2715330831e45e4 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Nov 30 00:43:27 2024 +0100 Add exports commit b374b7bbccfa655dfad7695d7a24c5ddd4a07b66 Author: Alex Lion <dev@alexandrelion.com> Date: Thu Nov 28 15:22:41 2024 +0100 Remove presence on manager commit 404e759ae3d2f5e555ae20437204553bffdc5065 Author: Alex Lion <dev@alexandrelion.com> Date: Thu Nov 28 15:22:33 2024 +0100 Improve engagement report commit 39dbec6692c2d3f74a97647a703993d6152bfa06 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Nov 23 15:39:59 2024 +0100 Add translation commit 354c2e30aece5bc7d800893ce8dee3868a1c1f71 Author: Alex Lion <dev@alexandrelion.com> Date: Sat Nov 23 15:18:53 2024 +0100 Change product tour behavior commit 5f253812282fb11011694b8828580d886f1f5899 Author: Alex <dev@alexandrelion.com> Date: Tue Nov 19 19:59:32 2024 +0100 WIP commit f411180433a05b89fc9d029e2b313968985e5c3f Author: Alex <dev@alexandrelion.com> Date: Tue Nov 19 19:32:30 2024 +0100 WIP commit 2b5989774eeb839f7b7b2a49377aca9fe4d68c09 Author: Alex <dev@alexandrelion.com> Date: Sun Nov 17 19:31:27 2024 +0100 WIP commit c8750a667f131b68818859796670c3022c6d53fe Author: Alex <dev@alexandrelion.com> Date: Sun Nov 17 18:23:01 2024 +0100 WIP commit fdb9efecb5688423ed2c82cf445868040653d380 Author: Alex <dev@alexandrelion.com> Date: Sun Nov 17 17:55:57 2024 +0100 WIP commit 5d12b12ce33eb5c1ba2a3307ef4ac679b279f511 Author: Alex <dev@alexandrelion.com> Date: Sat Nov 16 21:22:12 2024 +0100 WIP commit 548b714fda61464517247910af7e3e1c2bdae8cf Author: Alex <dev@alexandrelion.com> Date: Fri Nov 15 15:34:00 2024 +0100 WIP commit f0c87f34ea2ac837b4b3b3d6fd51c32bd625371e Author: Alex <dev@alexandrelion.com> Date: Wed Nov 13 22:09:24 2024 +0100 WIP commit c0c8bf99a538653208e28300566cced3d444a764 Author: Alex <dev@alexandrelion.com> Date: Mon Nov 11 13:02:36 2024 +0100 WIP commit 245ea9b836c2e69c7269fc7d8c7fd2edd0032eed Author: Alex <dev@alexandrelion.com> Date: Sun Nov 10 19:07:36 2024 +0100 Add presenter commit 0cf50918d62a9ab5ea127698219e05f781c659bb Author: Alex <dev@alexandrelion.com> Date: Sat Nov 9 23:20:35 2024 +0100 Refactor reactions commit ef8ffefe56d5b19dd895be181437c461134176ab Author: Alex <dev@alexandrelion.com> Date: Sat Nov 9 22:21:13 2024 +0100 Add tests commit c4055142ed63d8ea1be921f527bcaf595a2b9268 Author: Alex <dev@alexandrelion.com> Date: Sat Nov 9 11:28:00 2024 +0100 WIP commit 779e6970f7ee7ca89aab2bdfcff6197895b9ce5e Author: Alex <dev@alexandrelion.com> Date: Fri Nov 8 17:21:11 2024 +0100 WIP commit 9d25c440b830ded7e6fc2e0bcc9353520ec4a951 Author: Alex <dev@alexandrelion.com> Date: Fri Nov 8 11:54:31 2024 +0100 WIP commit c0157487a9e20b6773e517553681915c12367851 Author: Alex <dev@alexandrelion.com> Date: Fri Nov 1 17:13:04 2024 +0100 Fix condition commit a64439fbf2d852e127deb00a11906fb86b0c9ece Author: Alex <dev@alexandrelion.com> Date: Fri Nov 1 12:16:21 2024 +0100 WIP commit a994d959afe20ee380d42feb5ca6da2ab832d569 Author: Alex <dev@alexandrelion.com> Date: Wed Oct 30 23:06:24 2024 +0100 Fix changeset commit 5b2935fc33577af21ccc2558b49d9a813f4835f3 Merge: cec1a977476269Author: Alex <dev@alexandrelion.com> Date: Sun Oct 20 11:26:51 2024 +0200 Merge branch 'dev' into feature/quizz commit cec1a97650867da3a09d8e23d0756a3a573e1bc8 Author: Alex <dev@alexandrelion.com> Date: Sat Oct 19 22:52:00 2024 +0200 WIP commit f65854f638393ce80fd9d17642e8a90ee5c1a06e Author: Alex <dev@alexandrelion.com> Date: Sat Oct 19 16:55:42 2024 +0200 WIP commit 1e6429a386c56be6a8fdd2f083e273b50a6bc4c9 Merge:19779596f8a2fdAuthor: Alex <dev@alexandrelion.com> Date: Sat Oct 19 13:49:22 2024 +0200 Merge branch 'dev' into feature/quizz # Conflicts: # lib/claper_web/live/event_live/manage.html.heex commit1977959efbAuthor: Alex <dev@alexandrelion.com> Date: Sat Oct 5 12:57:09 2024 +0200 WIP
223 lines
7.5 KiB
Elixir
223 lines
7.5 KiB
Elixir
import Config
|
|
import Claper.ConfigHelpers
|
|
|
|
config_dir = System.get_env("CONFIG_DIR", "/run/secrets")
|
|
|
|
database_url =
|
|
get_var_from_path_or_env(
|
|
config_dir,
|
|
"DATABASE_URL",
|
|
"postgres://claper:claper@localhost:5432/postgres"
|
|
)
|
|
|
|
db_ssl = get_var_from_path_or_env(config_dir, "DB_SSL", "false") |> String.to_existing_atom()
|
|
|
|
# Listen IP supports IPv4 and IPv6 addresses.
|
|
listen_ip =
|
|
(
|
|
str = get_var_from_path_or_env(config_dir, "LISTEN_IP") || "0.0.0.0"
|
|
|
|
case :inet.parse_address(String.to_charlist(str)) do
|
|
{:ok, ip_addr} ->
|
|
ip_addr
|
|
|
|
{:error, reason} ->
|
|
raise "Invalid LISTEN_IP '#{str}' error: #{inspect(reason)}"
|
|
end
|
|
)
|
|
|
|
port = get_int_from_path_or_env(config_dir, "PORT", "4000")
|
|
|
|
secret_key_base = get_var_from_path_or_env(config_dir, "SECRET_KEY_BASE", nil)
|
|
|
|
if System.get_env("MIX_ENV") == "prod" or Application.get_env(:claper, :server, false) do
|
|
case secret_key_base do
|
|
nil ->
|
|
raise "SECRET_KEY_BASE configuration option is required. See https://docs.claper.co/configuration.html#production-docker"
|
|
|
|
key when byte_size(key) < 32 ->
|
|
raise "SECRET_KEY_BASE must be at least 32 bytes long. See https://docs.claper.co/configuration.html#production-docker"
|
|
|
|
_ ->
|
|
nil
|
|
end
|
|
end
|
|
|
|
base_url = get_var_from_path_or_env(config_dir, "BASE_URL", "http://localhost:4000")
|
|
|
|
if System.get_env("MIX_ENV") == "prod" or Application.get_env(:claper, :server, false) do
|
|
case base_url do
|
|
nil ->
|
|
raise "BASE_URL configuration option is required. See https://docs.claper.co/configuration.html#production-docker"
|
|
|
|
_ ->
|
|
nil
|
|
end
|
|
end
|
|
|
|
base_url = URI.parse(base_url)
|
|
|
|
if System.get_env("MIX_ENV") == "prod" or Application.get_env(:claper, :server, false) do
|
|
if base_url.scheme not in ["http", "https"] do
|
|
raise "BASE_URL must start with `http` or `https`. Currently configured as `#{System.get_env("BASE_URL")}`"
|
|
end
|
|
end
|
|
|
|
max_file_size = get_int_from_path_or_env(config_dir, "MAX_FILE_SIZE_MB", 15)
|
|
|
|
enable_account_creation =
|
|
get_var_from_path_or_env(config_dir, "ENABLE_ACCOUNT_CREATION", "true")
|
|
|> String.to_existing_atom()
|
|
|
|
email_confirmation =
|
|
get_var_from_path_or_env(config_dir, "EMAIL_CONFIRMATION", "false")
|
|
|> String.to_existing_atom()
|
|
|
|
pool_size = get_int_from_path_or_env(config_dir, "POOL_SIZE", 10)
|
|
queue_target = get_int_from_path_or_env(config_dir, "QUEUE_TARGET", 5_000)
|
|
|
|
mail_transport = get_var_from_path_or_env(config_dir, "MAIL_TRANSPORT", "local")
|
|
|
|
smtp_relay = get_var_from_path_or_env(config_dir, "SMTP_RELAY", nil)
|
|
smtp_username = get_var_from_path_or_env(config_dir, "SMTP_USERNAME", nil)
|
|
smtp_password = get_var_from_path_or_env(config_dir, "SMTP_PASSWORD", nil)
|
|
smtp_ssl = get_var_from_path_or_env(config_dir, "SMTP_SSL", "true") |> String.to_existing_atom()
|
|
smtp_tls = get_var_from_path_or_env(config_dir, "SMTP_TLS", "always")
|
|
smtp_auth = get_var_from_path_or_env(config_dir, "SMTP_AUTH", "always")
|
|
smtp_port = get_int_from_path_or_env(config_dir, "SMTP_PORT", 25)
|
|
|
|
aws_access_key_id = get_var_from_path_or_env(config_dir, "AWS_ACCESS_KEY_ID", nil)
|
|
aws_secret_access_key = get_var_from_path_or_env(config_dir, "AWS_SECRET_ACCESS_KEY", nil)
|
|
aws_region = get_var_from_path_or_env(config_dir, "AWS_REGION", nil)
|
|
|
|
same_site_cookie = get_var_from_path_or_env(config_dir, "SAME_SITE_COOKIE", "Lax")
|
|
|
|
secure_cookie =
|
|
get_var_from_path_or_env(config_dir, "SECURE_COOKIE", "false") |> String.to_existing_atom()
|
|
|
|
oidc_issuer = get_var_from_path_or_env(config_dir, "OIDC_ISSUER", "https://accounts.google.com")
|
|
|
|
oidc_client_id = get_var_from_path_or_env(config_dir, "OIDC_CLIENT_ID", nil)
|
|
oidc_client_secret = get_var_from_path_or_env(config_dir, "OIDC_CLIENT_SECRET", nil)
|
|
oidc_scopes = get_var_from_path_or_env(config_dir, "OIDC_SCOPES", "openid email profile")
|
|
oidc_provider_name = get_var_from_path_or_env(config_dir, "OIDC_PROVIDER_NAME", "OpenID Connect")
|
|
oidc_logo_url = get_var_from_path_or_env(config_dir, "OIDC_LOGO_URL", "/images/icons/openid.png")
|
|
|
|
oidc_auto_redirect_login =
|
|
get_var_from_path_or_env(config_dir, "OIDC_AUTO_REDIRECT_LOGIN", "false")
|
|
|> String.to_existing_atom()
|
|
|
|
oidc_property_mappings =
|
|
get_var_from_path_or_env(config_dir, "OIDC_PROPERTY_MAPPINGS", nil)
|
|
|> case do
|
|
nil ->
|
|
nil
|
|
|
|
mappings ->
|
|
String.split(mappings, ",")
|
|
|> Enum.map(&String.split(&1, ":"))
|
|
|> Enum.into(%{}, fn [key, value] -> {key, value} end)
|
|
end
|
|
|
|
oidc_enabled =
|
|
!is_nil(oidc_client_id) and !is_nil(oidc_client_secret)
|
|
|
|
allow_unlink_external_provider =
|
|
get_var_from_path_or_env(config_dir, "ALLOW_UNLINK_EXTERNAL_PROVIDER", "true")
|
|
|> String.to_existing_atom()
|
|
|
|
logout_redirect_url = get_var_from_path_or_env(config_dir, "LOGOUT_REDIRECT_URL", nil)
|
|
|
|
config :claper, :oidc,
|
|
enabled: oidc_enabled,
|
|
issuer: oidc_issuer,
|
|
client_id: oidc_client_id,
|
|
client_secret: oidc_client_secret,
|
|
scopes: String.split(oidc_scopes, " "),
|
|
provider_name: oidc_provider_name,
|
|
logo_url: oidc_logo_url,
|
|
property_mappings: oidc_property_mappings,
|
|
auto_redirect_login: oidc_auto_redirect_login
|
|
|
|
config :claper, Claper.Repo,
|
|
url: database_url,
|
|
ssl: db_ssl,
|
|
ssl_opts: [
|
|
verify: :verify_none
|
|
],
|
|
prepare: :unnamed,
|
|
pool_size: pool_size,
|
|
queue_target: queue_target
|
|
|
|
config :claper, ClaperWeb.Endpoint,
|
|
url: [scheme: base_url.scheme, host: base_url.host, path: base_url.path, port: base_url.port],
|
|
base_url: base_url,
|
|
http: [
|
|
ip: listen_ip,
|
|
port: port,
|
|
transport_options: [max_connections: :infinity],
|
|
protocol_options: [max_request_line_length: 8192, max_header_value_length: 8192]
|
|
],
|
|
secret_key_base: secret_key_base,
|
|
same_site_cookie: same_site_cookie,
|
|
secure_cookie: secure_cookie
|
|
|
|
config :claper,
|
|
enable_account_creation: enable_account_creation,
|
|
email_confirmation: email_confirmation,
|
|
allow_unlink_external_provider: allow_unlink_external_provider,
|
|
logout_redirect_url: logout_redirect_url
|
|
|
|
config :claper, :presentations,
|
|
max_file_size: max_file_size,
|
|
storage: get_var_from_path_or_env(config_dir, "PRESENTATION_STORAGE", "local"),
|
|
aws_bucket: get_var_from_path_or_env(config_dir, "AWS_PRES_BUCKET", nil),
|
|
resolution: get_var_from_path_or_env(config_dir, "GS_JPG_RESOLUTION", "300x300")
|
|
|
|
config :claper, :mail,
|
|
from: get_var_from_path_or_env(config_dir, "MAIL_FROM", "noreply@claper.co"),
|
|
from_name: get_var_from_path_or_env(config_dir, "MAIL_FROM_NAME", "Claper")
|
|
|
|
config :claper, ClaperWeb.MailboxGuard,
|
|
username: get_var_from_path_or_env(config_dir, "MAILBOX_USER", nil),
|
|
password: get_var_from_path_or_env(config_dir, "MAILBOX_PASSWORD", nil),
|
|
enabled:
|
|
get_var_from_path_or_env(config_dir, "ENABLE_MAILBOX_ROUTE", "false")
|
|
|> String.to_existing_atom()
|
|
|
|
case mail_transport do
|
|
"smtp" ->
|
|
config :claper, Claper.Mailer,
|
|
adapter: Swoosh.Adapters.SMTP,
|
|
relay: smtp_relay,
|
|
username: smtp_username,
|
|
password: smtp_password,
|
|
ssl: smtp_ssl,
|
|
# always, never, if_available
|
|
tls: smtp_tls,
|
|
# always, never, if_available
|
|
auth: smtp_auth,
|
|
port: smtp_port
|
|
|
|
config :swoosh, :api_client, false
|
|
|
|
"postmark" ->
|
|
config :claper, Claper.Mailer,
|
|
adapter: Swoosh.Adapters.Postmark,
|
|
api_key: get_var_from_path_or_env(config_dir, "POSTMARK_API_KEY", nil)
|
|
|
|
config :swoosh, :api_client, Swoosh.ApiClient.Hackney
|
|
|
|
_ ->
|
|
config :claper, Claper.Mailer, adapter: Swoosh.Adapters.Local
|
|
config :swoosh, :api_client, false
|
|
end
|
|
|
|
config :ex_aws,
|
|
access_key_id: aws_access_key_id,
|
|
secret_access_key: aws_secret_access_key,
|
|
region: aws_region,
|
|
normalize_path: false
|
|
|
|
config :swoosh, :api_client, Swoosh.ApiClient.Finch
|