Add runtime config option for enabled/disabling csv imports and exports

This commit is contained in:
Adrian Gruntkowski 2024-04-16 13:31:16 +02:00
parent b373c36dcc
commit e30f202dd3
2 changed files with 11 additions and 1 deletions

View File

@ -287,6 +287,11 @@ secure_cookie =
|> get_var_from_path_or_env("SECURE_COOKIE", if(is_selfhost, do: "false", else: "true"))
|> String.to_existing_atom()
csv_imports_exports_enabled =
config_dir
|> get_var_from_path_or_env("CSV_IMPORTS_EXPORTS_ENABLED", "true")
|> String.to_existing_atom()
license_key = get_var_from_path_or_env(config_dir, "LICENSE_KEY", "")
config :plausible,
@ -297,7 +302,8 @@ config :plausible,
custom_script_name: custom_script_name,
log_failed_login_attempts: log_failed_login_attempts,
license_key: license_key,
persistent_cache_dir: persistent_cache_dir
persistent_cache_dir: persistent_cache_dir,
csv_imports_exports_enabled: csv_imports_exports_enabled
config :plausible, :selfhost,
enable_email_verification: enable_email_verification,

View File

@ -49,4 +49,8 @@ defmodule Plausible do
unquote(small_build?)
end
end
def csv_imports_exports_enabled?() do
Application.fetch_env!(:plausible, :csv_imports_exports_enabled)
end
end