fix(sitemap): save generated sitemaps in configurable directory

Previously in priv/static, now by default in production in /var/lib/mobilizon/sitemap and
configurable through the $MOBILIZON_SITEMAP_PATH ENV variable

Closes #1321

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-09-05 20:04:26 +02:00
parent 13099e0f11
commit f28109ad50
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
4 changed files with 10 additions and 1 deletions

View file

@ -392,6 +392,9 @@ config :mobilizon, Mobilizon.Service.GlobalSearch.SearchMobilizon,
config :mobilizon, Mobilizon.Service.AntiSpam, service: Mobilizon.Service.AntiSpam.Akismet
config :mobilizon, Mobilizon.Service.SiteMap,
path: System.get_env("MOBILIZON_SITEMAP_PATH", "/var/lib/mobilizon/sitemap")
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"

View file

@ -92,6 +92,9 @@ config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads"
config :mobilizon, :exports, path: "uploads/exports"
config :mobilizon, Mobilizon.Service.SiteMap,
path: System.get_env("MOBILIZON_SITEMAP_PATH", "priv/static")
config :tz_world, data_dir: "_build/dev/lib/tz_world/priv"
config :mobilizon, :anonymous,

View file

@ -62,6 +62,9 @@ config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "test/uploads"
config :mobilizon, :exports, path: "test/uploads/exports"
config :mobilizon, Mobilizon.Service.SiteMap,
path: System.get_env("MOBILIZON_SITEMAP_PATH", "test/sitemap")
config :tz_world, data_dir: "_build/test/lib/tz_world/priv"
config :tesla, Mobilizon.Service.HTTP.ActivityPub,

View file

@ -24,7 +24,7 @@ defmodule Mobilizon.Service.SiteMap do
config = [
store: Sitemapper.FileStore,
store_config: [path: Application.app_dir(:mobilizon, "priv/static")],
store_config: [path: Application.get_env(:mobilizon, __MODULE__) |> get_in([:path])],
sitemap_url: Endpoint.url(),
gzip: false
]