2020-05-26 16:09:34 +03:00
|
|
|
|
import Config
|
2021-06-16 12:03:01 +03:00
|
|
|
|
import Plausible.ConfigHelpers
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-01-13 17:15:03 +03:00
|
|
|
|
if config_env() in [:dev, :test] do
|
2021-06-16 12:16:11 +03:00
|
|
|
|
Envy.load(["config/.env.#{config_env()}"])
|
2021-01-13 16:41:16 +03:00
|
|
|
|
end
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
config_dir = System.get_env("CONFIG_DIR", "/run/secrets")
|
2020-11-03 12:20:11 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
# System.get_env does not accept a non string default
|
|
|
|
|
port = get_var_from_path_or_env(config_dir, "PORT") || 8000
|
|
|
|
|
|
|
|
|
|
base_url = get_var_from_path_or_env(config_dir, "BASE_URL")
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-01-15 11:12:00 +03:00
|
|
|
|
if !base_url do
|
|
|
|
|
raise "BASE_URL configuration option is required. See https://plausible.io/docs/self-hosting-configuration#server"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
base_url = URI.parse(base_url)
|
|
|
|
|
|
|
|
|
|
if base_url.scheme not in ["http", "https"] do
|
2021-09-09 11:17:24 +03:00
|
|
|
|
raise "BASE_URL must start with `http` or `https`. Currently configured as `#{System.get_env("BASE_URL")}`"
|
2021-01-15 11:12:00 +03:00
|
|
|
|
end
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
secret_key_base = get_var_from_path_or_env(config_dir, "SECRET_KEY_BASE", nil)
|
2021-04-13 11:19:24 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
case secret_key_base do
|
|
|
|
|
nil ->
|
|
|
|
|
raise "SECRET_KEY_BASE configuration option is required. See https://plausible.io/docs/self-hosting-configuration#server"
|
2021-04-13 11:19:24 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
key when byte_size(key) < 64 ->
|
|
|
|
|
raise "SECRET_KEY_BASE must be at least 64 bytes long. See https://plausible.io/docs/self-hosting-configuration#server"
|
|
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
|
nil
|
|
|
|
|
end
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
|
|
|
|
db_url =
|
2021-06-16 12:03:01 +03:00
|
|
|
|
get_var_from_path_or_env(
|
|
|
|
|
config_dir,
|
2020-05-26 16:09:34 +03:00
|
|
|
|
"DATABASE_URL",
|
2020-10-05 15:01:54 +03:00
|
|
|
|
"postgres://postgres:postgres@plausible_db:5432/plausible_db"
|
2020-05-26 16:09:34 +03:00
|
|
|
|
)
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
db_socket_dir = get_var_from_path_or_env(config_dir, "DATABASE_SOCKET_DIR")
|
|
|
|
|
|
|
|
|
|
admin_user = get_var_from_path_or_env(config_dir, "ADMIN_USER_NAME")
|
|
|
|
|
admin_email = get_var_from_path_or_env(config_dir, "ADMIN_USER_EMAIL")
|
|
|
|
|
|
2021-06-16 15:33:37 +03:00
|
|
|
|
admin_user_ids =
|
|
|
|
|
get_var_from_path_or_env(config_dir, "ADMIN_USER_IDS", "")
|
2021-06-16 12:03:01 +03:00
|
|
|
|
|> String.split(",")
|
2021-06-16 15:43:26 +03:00
|
|
|
|
|> Enum.map(fn id -> Integer.parse(id) end)
|
|
|
|
|
|> Enum.map(fn
|
|
|
|
|
{int, ""} -> int
|
|
|
|
|
_ -> nil
|
|
|
|
|
end)
|
|
|
|
|
|> Enum.filter(& &1)
|
2021-06-16 12:03:01 +03:00
|
|
|
|
|
|
|
|
|
admin_pwd = get_var_from_path_or_env(config_dir, "ADMIN_USER_PWD")
|
|
|
|
|
env = get_var_from_path_or_env(config_dir, "ENVIRONMENT", "prod")
|
|
|
|
|
mailer_adapter = get_var_from_path_or_env(config_dir, "MAILER_ADAPTER", "Bamboo.SMTPAdapter")
|
|
|
|
|
mailer_email = get_var_from_path_or_env(config_dir, "MAILER_EMAIL", "hello@plausible.local")
|
|
|
|
|
app_version = get_var_from_path_or_env(config_dir, "APP_VERSION", "0.0.1")
|
2020-11-03 12:20:11 +03:00
|
|
|
|
|
|
|
|
|
ch_db_url =
|
2021-06-16 12:03:01 +03:00
|
|
|
|
get_var_from_path_or_env(
|
|
|
|
|
config_dir,
|
|
|
|
|
"CLICKHOUSE_DATABASE_URL",
|
|
|
|
|
"http://plausible_events_db:8123/plausible_events_db"
|
|
|
|
|
)
|
2020-11-03 12:20:11 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
{ch_flush_interval_ms, ""} =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("CLICKHOUSE_FLUSH_INTERVAL_MS", "5000")
|
|
|
|
|
|> Integer.parse()
|
|
|
|
|
|
|
|
|
|
{ch_max_buffer_size, ""} =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("CLICKHOUSE_MAX_BUFFER_SIZE", "10000")
|
|
|
|
|
|> Integer.parse()
|
2021-05-25 11:37:52 +03:00
|
|
|
|
|
2020-05-26 16:09:34 +03:00
|
|
|
|
### Mandatory params End
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
sentry_dsn = get_var_from_path_or_env(config_dir, "SENTRY_DSN")
|
|
|
|
|
paddle_auth_code = get_var_from_path_or_env(config_dir, "PADDLE_VENDOR_AUTH_CODE")
|
|
|
|
|
google_cid = get_var_from_path_or_env(config_dir, "GOOGLE_CLIENT_ID")
|
|
|
|
|
google_secret = get_var_from_path_or_env(config_dir, "GOOGLE_CLIENT_SECRET")
|
|
|
|
|
slack_hook_url = get_var_from_path_or_env(config_dir, "SLACK_WEBHOOK")
|
|
|
|
|
twitter_consumer_key = get_var_from_path_or_env(config_dir, "TWITTER_CONSUMER_KEY")
|
|
|
|
|
twitter_consumer_secret = get_var_from_path_or_env(config_dir, "TWITTER_CONSUMER_SECRET")
|
|
|
|
|
twitter_token = get_var_from_path_or_env(config_dir, "TWITTER_ACCESS_TOKEN")
|
|
|
|
|
twitter_token_secret = get_var_from_path_or_env(config_dir, "TWITTER_ACCESS_TOKEN_SECRET")
|
|
|
|
|
postmark_api_key = get_var_from_path_or_env(config_dir, "POSTMARK_API_KEY")
|
|
|
|
|
|
|
|
|
|
cron_enabled =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("CRON_ENABLED", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
|
|
|
|
custom_domain_server_ip = get_var_from_path_or_env(config_dir, "CUSTOM_DOMAIN_SERVER_IP")
|
|
|
|
|
custom_domain_server_user = get_var_from_path_or_env(config_dir, "CUSTOM_DOMAIN_SERVER_USER")
|
|
|
|
|
|
|
|
|
|
custom_domain_server_password =
|
|
|
|
|
get_var_from_path_or_env(config_dir, "CUSTOM_DOMAIN_SERVER_PASSWORD")
|
2021-04-13 12:36:47 +03:00
|
|
|
|
|
|
|
|
|
geolite2_country_db =
|
2021-06-16 12:03:01 +03:00
|
|
|
|
get_var_from_path_or_env(
|
|
|
|
|
config_dir,
|
2021-04-13 12:36:47 +03:00
|
|
|
|
"GEOLITE2_COUNTRY_DB",
|
|
|
|
|
Application.app_dir(:plausible) <> "/priv/geodb/dbip-country.mmdb"
|
|
|
|
|
)
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
disable_auth =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("DISABLE_AUTH", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
2021-10-18 13:01:54 +03:00
|
|
|
|
enable_email_verification =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("ENABLE_EMAIL_VERIFICATION", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
disable_registration =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("DISABLE_REGISTRATION", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
|
|
|
|
hcaptcha_sitekey = get_var_from_path_or_env(config_dir, "HCAPTCHA_SITEKEY")
|
|
|
|
|
hcaptcha_secret = get_var_from_path_or_env(config_dir, "HCAPTCHA_SECRET")
|
|
|
|
|
|
|
|
|
|
log_level =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("LOG_LEVEL", "warn")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
2021-09-28 22:26:36 +03:00
|
|
|
|
domain_blacklist =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("DOMAIN_BLACKLIST", "")
|
|
|
|
|
|> String.split(",")
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
is_selfhost =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("SELFHOST", "true")
|
|
|
|
|
|> String.to_existing_atom()
|
|
|
|
|
|
2021-07-23 15:17:32 +03:00
|
|
|
|
custom_script_name =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("CUSTOM_SCRIPT_NAME", "script")
|
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
{site_limit, ""} =
|
|
|
|
|
config_dir
|
2021-06-29 16:38:10 +03:00
|
|
|
|
|> get_var_from_path_or_env("SITE_LIMIT", "50")
|
2021-06-16 12:03:01 +03:00
|
|
|
|
|> Integer.parse()
|
2021-06-04 14:31:48 +03:00
|
|
|
|
|
|
|
|
|
site_limit_exempt =
|
2021-06-16 12:03:01 +03:00
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("SITE_LIMIT_EXEMPT", "")
|
|
|
|
|
|> String.split(",")
|
|
|
|
|
|> Enum.map(&String.trim/1)
|
2021-06-04 14:31:48 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
disable_cron =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("DISABLE_CRON", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
{user_agent_cache_limit, ""} =
|
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("USER_AGENT_CACHE_LIMIT", "1000")
|
|
|
|
|
|> Integer.parse()
|
2021-01-04 17:38:56 +03:00
|
|
|
|
|
|
|
|
|
user_agent_cache_stats =
|
2021-06-16 12:03:01 +03:00
|
|
|
|
config_dir
|
|
|
|
|
|> get_var_from_path_or_env("USER_AGENT_CACHE_STATS", "false")
|
|
|
|
|
|> String.to_existing_atom()
|
2021-01-04 17:38:56 +03:00
|
|
|
|
|
2020-05-26 16:09:34 +03:00
|
|
|
|
config :plausible,
|
|
|
|
|
admin_user: admin_user,
|
|
|
|
|
admin_email: admin_email,
|
|
|
|
|
admin_pwd: admin_pwd,
|
|
|
|
|
environment: env,
|
2021-01-07 11:42:45 +03:00
|
|
|
|
mailer_email: mailer_email,
|
2021-06-16 15:33:37 +03:00
|
|
|
|
admin_user_ids: admin_user_ids,
|
2021-05-04 15:37:58 +03:00
|
|
|
|
site_limit: site_limit,
|
2021-06-04 14:31:48 +03:00
|
|
|
|
site_limit_exempt: site_limit_exempt,
|
2021-07-23 15:17:32 +03:00
|
|
|
|
is_selfhost: is_selfhost,
|
2021-09-28 22:26:36 +03:00
|
|
|
|
custom_script_name: custom_script_name,
|
|
|
|
|
domain_blacklist: domain_blacklist
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2020-07-02 11:21:11 +03:00
|
|
|
|
config :plausible, :selfhost,
|
|
|
|
|
disable_authentication: disable_auth,
|
2021-10-18 13:01:54 +03:00
|
|
|
|
enable_email_verification: enable_email_verification,
|
2021-01-15 11:12:00 +03:00
|
|
|
|
disable_registration: if(!disable_auth, do: disable_registration, else: false)
|
2020-07-02 11:21:11 +03:00
|
|
|
|
|
2020-05-26 16:09:34 +03:00
|
|
|
|
config :plausible, PlausibleWeb.Endpoint,
|
2021-10-18 12:16:56 +03:00
|
|
|
|
url: [scheme: base_url.scheme, host: base_url.host, path: base_url.path, port: base_url.port],
|
2021-10-09 16:18:34 +03:00
|
|
|
|
http: [port: port, transport_options: [max_connections: :infinity]],
|
2021-01-13 16:41:16 +03:00
|
|
|
|
secret_key_base: secret_key_base
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
if is_nil(db_socket_dir) do
|
2021-10-09 16:33:20 +03:00
|
|
|
|
config :plausible, Plausible.Repo, url: db_url
|
2021-06-16 12:03:01 +03:00
|
|
|
|
else
|
|
|
|
|
config :plausible, Plausible.Repo,
|
|
|
|
|
socket_dir: db_socket_dir,
|
|
|
|
|
database: get_var_from_path_or_env(config_dir, "DATABASE_NAME", "plausible")
|
2021-05-26 15:40:56 +03:00
|
|
|
|
end
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
|
|
|
|
config :sentry,
|
|
|
|
|
dsn: sentry_dsn,
|
|
|
|
|
environment_name: env,
|
2020-06-04 11:00:07 +03:00
|
|
|
|
included_environments: ["prod", "staging"],
|
2020-05-26 16:09:34 +03:00
|
|
|
|
release: app_version,
|
2021-04-23 11:56:41 +03:00
|
|
|
|
tags: %{app_version: app_version},
|
|
|
|
|
enable_source_code_context: true,
|
|
|
|
|
root_source_code_path: [File.cwd!()]
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
|
|
|
|
config :plausible, :paddle, vendor_auth_code: paddle_auth_code
|
|
|
|
|
|
|
|
|
|
config :plausible, :google,
|
|
|
|
|
client_id: google_cid,
|
|
|
|
|
client_secret: google_secret
|
|
|
|
|
|
|
|
|
|
config :plausible, :slack, webhook: slack_hook_url
|
|
|
|
|
|
2020-09-17 16:36:01 +03:00
|
|
|
|
config :plausible, Plausible.ClickhouseRepo,
|
|
|
|
|
loggers: [Ecto.LogEntry],
|
2021-05-06 18:03:42 +03:00
|
|
|
|
queue_target: 500,
|
|
|
|
|
queue_interval: 2000,
|
2021-05-25 11:37:52 +03:00
|
|
|
|
url: ch_db_url,
|
|
|
|
|
flush_interval_ms: ch_flush_interval_ms,
|
|
|
|
|
max_buffer_size: ch_max_buffer_size
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
|
|
|
|
case mailer_adapter do
|
|
|
|
|
"Bamboo.PostmarkAdapter" ->
|
|
|
|
|
config :plausible, Plausible.Mailer,
|
|
|
|
|
adapter: :"Elixir.#{mailer_adapter}",
|
2020-12-22 16:50:08 +03:00
|
|
|
|
request_options: [recv_timeout: 10_000],
|
2021-06-16 12:03:01 +03:00
|
|
|
|
api_key: get_var_from_path_or_env(config_dir, "POSTMARK_API_KEY")
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
|
|
|
|
"Bamboo.SMTPAdapter" ->
|
|
|
|
|
config :plausible, Plausible.Mailer,
|
|
|
|
|
adapter: :"Elixir.#{mailer_adapter}",
|
2021-06-16 12:03:01 +03:00
|
|
|
|
server: get_var_from_path_or_env(config_dir, "SMTP_HOST_ADDR", "mail"),
|
2020-10-05 15:01:54 +03:00
|
|
|
|
hostname: base_url.host,
|
2021-06-16 12:03:01 +03:00
|
|
|
|
port: get_var_from_path_or_env(config_dir, "SMTP_HOST_PORT", "25"),
|
|
|
|
|
username: get_var_from_path_or_env(config_dir, "SMTP_USER_NAME"),
|
|
|
|
|
password: get_var_from_path_or_env(config_dir, "SMTP_USER_PWD"),
|
2020-05-26 16:09:34 +03:00
|
|
|
|
tls: :if_available,
|
|
|
|
|
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
|
2021-06-29 15:26:42 +03:00
|
|
|
|
ssl: get_var_from_path_or_env(config_dir, "SMTP_HOST_SSL_ENABLED") || false,
|
|
|
|
|
retries: get_var_from_path_or_env(config_dir, "SMTP_RETRIES") || 2,
|
2021-06-16 12:03:01 +03:00
|
|
|
|
no_mx_lookups: get_var_from_path_or_env(config_dir, "SMTP_MX_LOOKUPS_ENABLED") || true
|
2020-05-26 16:09:34 +03:00
|
|
|
|
|
2021-01-13 16:41:16 +03:00
|
|
|
|
"Bamboo.LocalAdapter" ->
|
2021-01-13 18:04:01 +03:00
|
|
|
|
config :plausible, Plausible.Mailer, adapter: Bamboo.LocalAdapter
|
|
|
|
|
|
|
|
|
|
"Bamboo.TestAdapter" ->
|
|
|
|
|
config :plausible, Plausible.Mailer, adapter: Bamboo.TestAdapter
|
2021-01-13 16:41:16 +03:00
|
|
|
|
|
2020-05-26 16:09:34 +03:00
|
|
|
|
_ ->
|
|
|
|
|
raise "Unknown mailer_adapter; expected SMTPAdapter or PostmarkAdapter"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
config :plausible, :twitter,
|
|
|
|
|
consumer_key: twitter_consumer_key,
|
|
|
|
|
consumer_secret: twitter_consumer_secret,
|
|
|
|
|
token: twitter_token,
|
|
|
|
|
token_secret: twitter_token_secret
|
|
|
|
|
|
2020-06-04 14:33:54 +03:00
|
|
|
|
config :plausible, :custom_domain_server,
|
|
|
|
|
user: custom_domain_server_user,
|
2020-06-04 20:25:13 +03:00
|
|
|
|
password: custom_domain_server_password,
|
2020-06-04 14:33:54 +03:00
|
|
|
|
ip: custom_domain_server_ip
|
|
|
|
|
|
2020-08-11 11:04:26 +03:00
|
|
|
|
config :plausible, PlausibleWeb.Firewall,
|
2021-06-16 12:03:01 +03:00
|
|
|
|
blocklist:
|
|
|
|
|
get_var_from_path_or_env(config_dir, "IP_BLOCKLIST", "")
|
|
|
|
|
|> String.split(",")
|
|
|
|
|
|> Enum.map(&String.trim/1)
|
2020-08-11 11:04:26 +03:00
|
|
|
|
|
2021-01-18 12:28:18 +03:00
|
|
|
|
if config_env() == :prod && !disable_cron do
|
2021-01-13 18:04:01 +03:00
|
|
|
|
base_cron = [
|
|
|
|
|
# Daily at midnight
|
2021-01-15 11:12:00 +03:00
|
|
|
|
{"0 0 * * *", Plausible.Workers.RotateSalts},
|
2021-01-13 18:04:01 +03:00
|
|
|
|
# hourly
|
|
|
|
|
{"0 * * * *", Plausible.Workers.ScheduleEmailReports},
|
2021-01-15 11:12:00 +03:00
|
|
|
|
# hourly
|
|
|
|
|
{"0 * * * *", Plausible.Workers.SendSiteSetupEmails},
|
2021-01-13 18:04:01 +03:00
|
|
|
|
# Daily at midnight
|
|
|
|
|
{"0 0 * * *", Plausible.Workers.FetchTweets},
|
|
|
|
|
# Daily at midday
|
|
|
|
|
{"0 12 * * *", Plausible.Workers.SendCheckStatsEmails},
|
|
|
|
|
# Every 15 minutes
|
|
|
|
|
{"*/15 * * * *", Plausible.Workers.SpikeNotifier},
|
|
|
|
|
# Every day at midnight
|
2021-06-16 15:00:07 +03:00
|
|
|
|
{"0 0 * * *", Plausible.Workers.CleanEmailVerificationCodes},
|
|
|
|
|
# Every day at 1am
|
|
|
|
|
{"0 1 * * *", Plausible.Workers.CleanInvitations}
|
2021-01-13 18:04:01 +03:00
|
|
|
|
]
|
|
|
|
|
|
2021-01-15 11:12:00 +03:00
|
|
|
|
extra_cron = [
|
|
|
|
|
# Daily at midday
|
|
|
|
|
{"0 12 * * *", Plausible.Workers.SendTrialNotifications},
|
2021-02-19 16:15:56 +03:00
|
|
|
|
# Daily at 14
|
|
|
|
|
{"0 14 * * *", Plausible.Workers.CheckUsage},
|
2021-04-21 15:57:38 +03:00
|
|
|
|
# Daily at 15
|
|
|
|
|
{"0 15 * * *", Plausible.Workers.NotifyAnnualRenewal},
|
2021-01-15 11:12:00 +03:00
|
|
|
|
# Every 10 minutes
|
2021-06-16 15:00:07 +03:00
|
|
|
|
{"*/10 * * * *", Plausible.Workers.ProvisionSslCertificates},
|
|
|
|
|
# Every midnight
|
|
|
|
|
{"0 0 * * *", Plausible.Workers.LockSites}
|
2021-01-15 11:12:00 +03:00
|
|
|
|
]
|
2021-01-13 18:04:01 +03:00
|
|
|
|
|
2021-01-15 11:12:00 +03:00
|
|
|
|
base_queues = [
|
|
|
|
|
rotate_salts: 1,
|
2021-01-13 18:04:01 +03:00
|
|
|
|
schedule_email_reports: 1,
|
|
|
|
|
send_email_reports: 1,
|
|
|
|
|
spike_notifications: 1,
|
2021-01-15 11:12:00 +03:00
|
|
|
|
fetch_tweets: 1,
|
|
|
|
|
check_stats_emails: 1,
|
2021-06-16 15:00:07 +03:00
|
|
|
|
site_setup_emails: 1,
|
|
|
|
|
clean_email_verification_codes: 1,
|
|
|
|
|
clean_invitations: 1
|
2021-01-15 11:12:00 +03:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
extra_queues = [
|
|
|
|
|
provision_ssl_certificates: 1,
|
2021-02-19 16:15:56 +03:00
|
|
|
|
trial_notification_emails: 1,
|
2021-04-21 15:57:38 +03:00
|
|
|
|
check_usage: 1,
|
2021-06-16 15:00:07 +03:00
|
|
|
|
notify_annual_renewal: 1,
|
|
|
|
|
lock_sites: 1
|
2021-01-13 18:04:01 +03:00
|
|
|
|
]
|
|
|
|
|
|
2021-04-26 11:32:18 +03:00
|
|
|
|
# Keep 30 days history
|
2021-01-13 18:04:01 +03:00
|
|
|
|
config :plausible, Oban,
|
|
|
|
|
repo: Plausible.Repo,
|
2021-04-26 11:32:18 +03:00
|
|
|
|
plugins: [{Oban.Plugins.Pruner, max_age: 2_592_000}],
|
2021-01-15 11:12:00 +03:00
|
|
|
|
queues: if(is_selfhost, do: base_queues, else: base_queues ++ extra_queues),
|
|
|
|
|
crontab: if(is_selfhost, do: base_cron, else: base_cron ++ extra_cron)
|
|
|
|
|
else
|
|
|
|
|
config :plausible, Oban,
|
|
|
|
|
repo: Plausible.Repo,
|
|
|
|
|
queues: false,
|
2021-04-26 11:32:18 +03:00
|
|
|
|
plugins: false
|
2021-01-13 18:04:01 +03:00
|
|
|
|
end
|
2020-06-04 11:23:30 +03:00
|
|
|
|
|
2020-08-28 15:00:16 +03:00
|
|
|
|
config :plausible, :hcaptcha,
|
|
|
|
|
sitekey: hcaptcha_sitekey,
|
|
|
|
|
secret: hcaptcha_secret
|
|
|
|
|
|
2020-06-09 18:24:08 +03:00
|
|
|
|
config :ref_inspector,
|
|
|
|
|
init: {Plausible.Release, :configure_ref_inspector}
|
|
|
|
|
|
|
|
|
|
config :ua_inspector,
|
|
|
|
|
init: {Plausible.Release, :configure_ua_inspector}
|
|
|
|
|
|
2021-01-04 17:38:56 +03:00
|
|
|
|
config :plausible, :user_agent_cache,
|
|
|
|
|
limit: user_agent_cache_limit,
|
|
|
|
|
stats: user_agent_cache_stats
|
|
|
|
|
|
2021-05-25 11:32:54 +03:00
|
|
|
|
config :hammer,
|
|
|
|
|
backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4, cleanup_interval_ms: 60_000 * 10]}
|
|
|
|
|
|
2021-01-08 17:54:17 +03:00
|
|
|
|
config :kaffy,
|
|
|
|
|
otp_app: :plausible,
|
|
|
|
|
ecto_repo: Plausible.Repo,
|
|
|
|
|
router: PlausibleWeb.Router,
|
|
|
|
|
admin_title: "Plausible Admin",
|
|
|
|
|
resources: [
|
|
|
|
|
auth: [
|
|
|
|
|
resources: [
|
2021-06-10 10:25:19 +03:00
|
|
|
|
user: [schema: Plausible.Auth.User, admin: Plausible.Auth.UserAdmin],
|
|
|
|
|
api_key: [schema: Plausible.Auth.ApiKey, admin: Plausible.Auth.ApiKeyAdmin]
|
2021-01-08 17:54:17 +03:00
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
sites: [
|
|
|
|
|
resources: [
|
|
|
|
|
site: [schema: Plausible.Site, admin: Plausible.SiteAdmin]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
|
2021-04-12 12:21:07 +03:00
|
|
|
|
if config_env() != :test && geolite2_country_db do
|
2020-06-12 09:51:45 +03:00
|
|
|
|
config :geolix,
|
|
|
|
|
databases: [
|
|
|
|
|
%{
|
|
|
|
|
id: :country,
|
|
|
|
|
adapter: Geolix.Adapter.MMDB2,
|
|
|
|
|
source: geolite2_country_db
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-29 11:24:20 +03:00
|
|
|
|
config :logger,
|
|
|
|
|
level: log_level,
|
2021-05-24 11:07:19 +03:00
|
|
|
|
backends: [:console]
|
2021-01-29 11:24:20 +03:00
|
|
|
|
|
2021-03-30 15:51:05 +03:00
|
|
|
|
config :logger, Sentry.LoggerBackend,
|
|
|
|
|
capture_log_messages: true,
|
|
|
|
|
level: :error,
|
|
|
|
|
excluded_domains: []
|
2021-06-03 10:55:48 +03:00
|
|
|
|
|
2021-06-16 12:03:01 +03:00
|
|
|
|
config :tzdata,
|
|
|
|
|
:data_dir,
|
|
|
|
|
get_var_from_path_or_env(config_dir, "STORAGE_DIR", Application.app_dir(:tzdata, "priv"))
|