config.exs 9.37 KB
Newer Older
Thomas Citharel's avatar
Thomas Citharel committed
1
2
3
4
5
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
Thomas Citharel's avatar
Thomas Citharel committed
6
import Config
Thomas Citharel's avatar
Thomas Citharel committed
7
8

# General application configuration
Thomas Citharel's avatar
Thomas Citharel committed
9
config :mobilizon,
10
  ecto_repos: [Mobilizon.Storage.Repo],
11
  env: config_env()
Thomas Citharel's avatar
Thomas Citharel committed
12

13
14
config :mobilizon, Mobilizon.Storage.Repo, types: Mobilizon.Storage.PostgresTypes

Thomas Citharel's avatar
Thomas Citharel committed
15
config :mobilizon, :instance,
16
17
18
19
  name: "My Mobilizon Instance",
  description: "Change this to a proper description of your instance",
  hostname: "localhost",
  registrations_open: false,
Thomas Citharel's avatar
Thomas Citharel committed
20
  registration_email_allowlist: [],
21
  registration_email_denylist: [],
22
  languages: [],
23
  default_language: "en",
24
  demo: false,
Thomas Citharel's avatar
Thomas Citharel committed
25
  repository: Mix.Project.config()[:source_url],
Thomas Citharel's avatar
Thomas Citharel committed
26
  allow_relay: true,
27
  federating: true,
Thomas Citharel's avatar
Thomas Citharel committed
28
  remote_limit: 100_000,
Thomas Citharel's avatar
Thomas Citharel committed
29
30
31
  upload_limit: 10_485_760,
  avatar_upload_limit: 2_097_152,
  banner_upload_limit: 4_194_304,
32
33
  remove_orphan_uploads: true,
  orphan_upload_grace_period_hours: 48,
Thomas Citharel's avatar
Thomas Citharel committed
34
35
  remove_unconfirmed_users: true,
  unconfirmed_user_grace_period_hours: 48,
36
37
  activity_expire_days: 365,
  activity_keep_number: 100,
38
  enable_instance_feeds: false,
39
40
  email_from: "noreply@localhost",
  email_reply_to: "noreply@localhost"
Thomas Citharel's avatar
WIP    
Thomas Citharel committed
41

Thomas Citharel's avatar
Thomas Citharel committed
42
config :mobilizon, :groups, enabled: true
43
config :mobilizon, :events, creation: true
Thomas Citharel's avatar
WIP    
Thomas Citharel committed
44

45
46
47
config :mobilizon, :restrictions, only_admin_can_create_groups: false
config :mobilizon, :restrictions, only_groups_can_create_events: false

Thomas Citharel's avatar
Thomas Citharel committed
48
# Configures the endpoint
rustra's avatar
rustra committed
49
config :mobilizon, Mobilizon.Web.Endpoint,
50
51
52
53
  url: [
    host: "mobilizon.local",
    scheme: "https"
  ],
Thomas Citharel's avatar
Thomas Citharel committed
54
  secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM",
rustra's avatar
rustra committed
55
  render_errors: [view: Mobilizon.Web.ErrorView, accepts: ~w(html json)],
56
  pubsub_server: Mobilizon.PubSub,
57
58
  cache_static_manifest: "priv/static/manifest.json",
  has_reverse_proxy: true
Thomas Citharel's avatar
Thomas Citharel committed
59

60
61
config :mime, :types, %{
  "application/activity+json" => ["activity-json"],
62
  "application/ld+json" => ["activity-json"],
63
64
  "application/jrd+json" => ["jrd-json"],
  "application/xrd+xml" => ["xrd-xml"]
65
66
}

Thomas Citharel's avatar
Thomas Citharel committed
67
# Upload configuration
rustra's avatar
rustra committed
68
69
config :mobilizon, Mobilizon.Web.Upload,
  uploader: Mobilizon.Web.Upload.Uploader.Local,
70
  filters: [
71
    Mobilizon.Web.Upload.Filter.AnalyzeMetadata,
72
    Mobilizon.Web.Upload.Filter.Resize,
73
74
75
    Mobilizon.Web.Upload.Filter.Optimize,
    Mobilizon.Web.Upload.Filter.BlurHash,
    Mobilizon.Web.Upload.Filter.Dedupe
76
  ],
77
  allow_list_mime_types: ["image/gif", "image/jpeg", "image/png", "image/webp"],
Thomas Citharel's avatar
Thomas Citharel committed
78
79
80
81
82
83
84
85
86
87
88
  link_name: true,
  proxy_remote: false,
  proxy_opts: [
    redirect_on_failure: false,
    max_body_length: 25 * 1_048_576,
    http: [
      follow_redirect: true,
      pool: :upload
    ]
  ]

Thomas Citharel's avatar
Thomas Citharel committed
89
config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "/var/lib/mobilizon/uploads"
Thomas Citharel's avatar
Thomas Citharel committed
90

91
92
config :tz_world, data_dir: "/var/lib/mobilizon/timezones"

93
94
config :mobilizon, Timex.Gettext, default_locale: "en"

95
96
97
98
99
100
101
102
103
104
105
config :mobilizon, :media_proxy,
  enabled: true,
  proxy_opts: [
    redirect_on_failure: false,
    max_body_length: 25 * 1_048_576,
    # Note: max_read_duration defaults to Mobilizon.Web.ReverseProxy.max_read_duration_default/1
    max_read_duration: 30_000,
    http: [
      follow_redirect: true,
      pool: :media
    ]
Thomas Citharel's avatar
Thomas Citharel committed
106
  ]
107

108
109
110
111
config :mobilizon, Mobilizon.Web.Email.Mailer,
  adapter: Bamboo.SMTPAdapter,
  server: "localhost",
  hostname: "localhost",
112
  # usually 25, 465 or 587
113
114
115
116
117
118
119
120
121
122
  port: 25,
  username: nil,
  password: nil,
  # can be `:always` or `:never`
  tls: :if_available,
  allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
  retries: 1,
  # can be `true`
  no_mx_lookups: false

Thomas Citharel's avatar
Thomas Citharel committed
123
124
# Configures Elixir's Logger
config :logger, :console,
125
  backends: [:console],
Thomas Citharel's avatar
Thomas Citharel committed
126
127
128
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

Thomas Citharel's avatar
Thomas Citharel committed
129
130
131
132
config :logger, Sentry.LoggerBackend,
  level: :warn,
  capture_log_messages: true

133
134
135
136
137
138
config :mobilizon, Mobilizon.Web.Auth.Guardian,
  issuer: "mobilizon",
  token_ttl: %{
    "access" => {15, :minutes},
    "refresh" => {60, :days}
  }
139
140

config :guardian, Guardian.DB,
miffy's avatar
miffy committed
141
  repo: Mobilizon.Storage.Repo,
142
143
144
  # default
  schema_name: "guardian_tokens",
  # store all token types if not set
145
  token_types: ["refresh"],
146
147
  # default: 60 minutes
  sweep_interval: 60
Thomas Citharel's avatar
Thomas Citharel committed
148

149
150
config :elixir, :time_zone_database, Tzdata.TimeZoneDatabase

151
152
153
154
155
156
157
158
159
160
config :mobilizon,
       Mobilizon.Service.Auth.Authenticator,
       Mobilizon.Service.Auth.MobilizonAuthenticator

config :ueberauth,
       Ueberauth,
       providers: []

config :mobilizon, :auth, oauth_consumer_strategies: []

Thomas Citharel's avatar
Thomas Citharel committed
161
config :geolix,
162
163
164
165
  databases: [
    %{
      id: :city,
      adapter: Geolix.Adapter.MMDB2,
Thomas Citharel's avatar
Thomas Citharel committed
166
      source: "/var/lib/mobilizon/geo/GeoLite2-City.mmdb"
167
168
    }
  ]
Thomas Citharel's avatar
Thomas Citharel committed
169

Thomas Citharel's avatar
Thomas Citharel committed
170
171
172
173
174
175
176
177
config :mobilizon, Mobilizon.Service.Formatter,
  class: false,
  rel: "noopener noreferrer ugc",
  new_window: true,
  truncate: false,
  strip_prefix: false,
  extra: true,
  validate_tld: :no_scheme
178

Thomas Citharel's avatar
Thomas Citharel committed
179
180
config :tesla, adapter: Tesla.Adapter.Hackney

Vincent's avatar
Vincent committed
181
config :phoenix, :format_encoders, json: Jason, "activity-json": Jason
Thomas Citharel's avatar
Thomas Citharel committed
182
config :phoenix, :json_library, Jason
Thomas Citharel's avatar
Thomas Citharel committed
183
config :phoenix, :filter_parameters, ["password", "token"]
184

185
186
187
config :absinthe, schema: Mobilizon.GraphQL.Schema
config :absinthe, Absinthe.Logger, filter_variables: ["token", "password", "secret"]

Thomas Citharel's avatar
Thomas Citharel committed
188
189
config :mobilizon, Mobilizon.Web.Gettext, one_module_per_locale: true

190
191
192
193
config :ex_cldr,
  default_locale: "en",
  default_backend: Mobilizon.Cldr

Thomas Citharel's avatar
Thomas Citharel committed
194
config :http_signatures,
rustra's avatar
rustra committed
195
  adapter: Mobilizon.Federation.HTTPSignatures.Signature
Thomas Citharel's avatar
Thomas Citharel committed
196

197
198
199
config :mobilizon, :cldr,
  locales: [
    "fr",
Thomas Citharel's avatar
Thomas Citharel committed
200
    "en",
Thomas Citharel's avatar
Thomas Citharel committed
201
202
    "ru",
    "ar"
203
204
  ]

205
206
207
208
209
config :mobilizon, :activitypub,
  # One day
  actor_stale_period: 3_600 * 48,
  actor_key_rotation_delay: 3_600 * 48,
  sign_object_fetches: true
210

211
212
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim

213
config :mobilizon, Mobilizon.Service.Geospatial.Nominatim,
214
215
  endpoint: "https://nominatim.openstreetmap.org",
  api_key: nil
216
217

config :mobilizon, Mobilizon.Service.Geospatial.Addok,
218
  endpoint: "https://api-adresse.data.gouv.fr"
219

220
config :mobilizon, Mobilizon.Service.Geospatial.Photon, endpoint: "https://photon.komoot.de"
221
222

config :mobilizon, Mobilizon.Service.Geospatial.GoogleMaps,
223
224
  api_key: nil,
  fetch_place_details: true
225

226
config :mobilizon, Mobilizon.Service.Geospatial.MapQuest, api_key: nil
Thomas Citharel's avatar
Thomas Citharel committed
227

228
config :mobilizon, Mobilizon.Service.Geospatial.Mimirsbrunn, endpoint: nil
229

230
config :mobilizon, Mobilizon.Service.Geospatial.Pelias, endpoint: nil
231

232
233
config :mobilizon, :maps,
  tiles: [
234
235
    endpoint: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    attribution: "© The OpenStreetMap Contributors"
236
237
238
  ],
  routing: [
    type: :openstreetmap
239
240
  ]

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
config :mobilizon, :http_security,
  enabled: true,
  sts: false,
  sts_max_age: 31_536_000,
  csp_policy: [
    script_src: [],
    style_src: [],
    connect_src: [],
    font_src: [],
    img_src: ["*.tile.openstreetmap.org"],
    manifest_src: [],
    media_src: [],
    object_src: [],
    frame_src: [],
    frame_ancestors: []
  ],
  referrer_policy: "same-origin"

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
config :mobilizon, :anonymous,
  participation: [
    allowed: true,
    validation: %{
      email: [
        enabled: true,
        confirmation_required: true
      ],
      captcha: [enabled: false]
    }
  ],
  event_creation: [
    allowed: false,
    validation: %{
      email: [
        enabled: true,
        confirmation_required: true
      ],
      captcha: [enabled: false]
    }
279
280
281
  ],
  reports: [
    allowed: false
282
283
  ]

284
285
config :mobilizon, Oban,
  repo: Mobilizon.Storage.Repo,
Thomas Citharel's avatar
Thomas Citharel committed
286
  log: false,
Thomas Citharel's avatar
WIP    
Thomas Citharel committed
287
  queues: [default: 10, search: 5, mailers: 10, background: 5, activity: 5, notifications: 5],
Thomas Citharel's avatar
Thomas Citharel committed
288
289
290
291
  plugins: [
    {Oban.Plugins.Cron,
     crontab: [
       {"@hourly", Mobilizon.Service.Workers.BuildSiteMap, queue: :background},
292
       {"17 4 * * *", Mobilizon.Service.Workers.RefreshGroups, queue: :background},
Thomas Citharel's avatar
Thomas Citharel committed
293
       {"@hourly", Mobilizon.Service.Workers.CleanOrphanMediaWorker, queue: :background},
294
       {"@hourly", Mobilizon.Service.Workers.CleanUnconfirmedUsersWorker, queue: :background},
295
       {"@hourly", Mobilizon.Service.Workers.ExportCleanerWorker, queue: :background},
Thomas Citharel's avatar
Thomas Citharel committed
296
       {"@hourly", Mobilizon.Service.Workers.SendActivityRecapWorker, queue: :notifications},
297
       {"@daily", Mobilizon.Service.Workers.CleanOldActivityWorker, queue: :background}
298
299
     ]},
    {Oban.Plugins.Pruner, max_age: 300}
Thomas Citharel's avatar
Thomas Citharel committed
300
  ]
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319

config :mobilizon, :rich_media,
  parsers: [
    Mobilizon.Service.RichMedia.Parsers.OEmbed,
    Mobilizon.Service.RichMedia.Parsers.OGP,
    Mobilizon.Service.RichMedia.Parsers.TwitterCard,
    Mobilizon.Service.RichMedia.Parsers.Fallback
  ]

config :mobilizon, Mobilizon.Service.ResourceProviders,
  types: [],
  providers: %{}

config :mobilizon, :external_resource_providers, %{
  "https://drive.google.com/" => :google_drive,
  "https://docs.google.com/document/" => :google_docs,
  "https://docs.google.com/presentation/" => :google_presentation,
  "https://docs.google.com/spreadsheets/" => :google_spreadsheets
}
320

Thomas Citharel's avatar
WIP    
Thomas Citharel committed
321
322
323
324
325
326
config :mobilizon, Mobilizon.Service.Notifier,
  notifiers: [
    Mobilizon.Service.Notifier.Email,
    Mobilizon.Service.Notifier.Push
  ]

Thomas Citharel's avatar
Thomas Citharel committed
327
328
329
330
config :mobilizon, Mobilizon.Service.Notifier.Email, enabled: true

config :mobilizon, Mobilizon.Service.Notifier.Push, enabled: true

331
config :mobilizon, :exports,
332
  path: "/var/lib/mobilizon/uploads/exports",
333
334
335
336
  formats: [
    Mobilizon.Service.Export.Participants.CSV
  ]

Thomas Citharel's avatar
Thomas Citharel committed
337
338
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
339
import_config "#{config_env()}.exs"