Skip to content

Commit

Permalink
#892 [Storage] CMS: export all files
Browse files Browse the repository at this point in the history
  • Loading branch information
mellelieuwes committed Jul 2, 2024
1 parent 781e4f9 commit f02acc9
Show file tree
Hide file tree
Showing 22 changed files with 206 additions and 124 deletions.
10 changes: 4 additions & 6 deletions core/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ config :plug, :statuses, %{
404 => "Page not found"
}

config :core, :naming, handlers: [Systems.Project.Public]

config :core, CoreWeb.FileUploader, max_file_size: 100_000_000

config :core,
Expand Down Expand Up @@ -69,7 +71,8 @@ config :core, :rate,
quotas: [
[service: :azure_blob, limit: 1000, unit: :call, window: :minute, scope: :local],
[service: :azure_blob, limit: 10_000_000, unit: :byte, window: :day, scope: :local],
[service: :azure_blob, limit: 1_000_000_000, unit: :byte, window: :day, scope: :global]
[service: :azure_blob, limit: 1_000_000_000, unit: :byte, window: :day, scope: :global],
[service: :storage_export, limit: 1, unit: :call, window: :minute, scope: :local]
]

config :core, ecto_repos: [Core.Repo]
Expand Down Expand Up @@ -124,11 +127,6 @@ config :core, :ssl,

config :core, :ssl_proxied, {:ok, "true"} == System.fetch_env("SSL_PROXIED")

config :web_push_encryption, :vapid_details,
subject: "mailto:administrator@example.com",
public_key: "use `mix web_push.gen.keypair`",
private_key: ""

config :core, :version, System.get_env("VERSION", "dev")

config :core, :assignment, external_panels: ~w(liss ioresearch generic)
Expand Down
1 change: 1 addition & 0 deletions core/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ config :core, Systems.Storage.BuiltIn, special: Systems.Storage.BuiltIn.LocalFS
config :core, :rate,
prune_interval: 5 * 60 * 1000,
quotas: [
[service: :storage_export, limit: 10, unit: :call, window: :minute, scope: :local],
[service: :azure_blob, limit: 1, unit: :call, window: :second, scope: :local],
[service: :azure_blob, limit: 100, unit: :byte, window: :second, scope: :local]
]
Expand Down
7 changes: 0 additions & 7 deletions core/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ if config_env() == :prod do
access_key: System.get_env("UNSPLASH_ACCESS_KEY"),
app_name: System.get_env("UNSPLASH_APP_NAME")

config :web_push_encryption, :vapid_details,
subject: "mailto:admin@#{app_mail_domain}",
public_key: System.get_env("WEB_PUSH_PUBLIC_KEY"),
private_key: System.get_env("WEB_PUSH_PRIVATE_KEY")

config :logger, level: System.get_env("LOG_LEVEL", "info") |> String.to_existing_atom()

if sentry_dsn = System.get_env("SENTRY_DSN") do
config :sentry,
dsn: sentry_dsn,
Expand Down
23 changes: 23 additions & 0 deletions core/frameworks/concept/context.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule Frameworks.Concept.Context do
defmodule Handler do
@type model :: struct()
@callback name(model) :: {:ok, binary()} | {:error, atom()}
end

def name(model, default) when is_struct(model) and is_binary(default) do
Enum.reduce(handlers(), default, fn handler, acc ->
case handler.name(model) do
{:ok, name} -> name
{:error, _} -> acc
end
end)
end

defp handlers() do
Access.get(settings(), :handlers, [])
end

defp settings() do
Application.fetch_env!(:core, :naming)
end
end
2 changes: 1 addition & 1 deletion core/lib/core/apns.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ defmodule Core.APNS do
Logger.error("Unexpected push error: #{inspect(response)}")
end

defp backend, do: Application.get_env(:core, :apns_backend, Pigeon.APNS)
defp backend, do: Application.get_env(:core, :apns_backend)
end
25 changes: 0 additions & 25 deletions core/lib/core_web/controllers/push_subscription_controller.ex

This file was deleted.

3 changes: 0 additions & 3 deletions core/lib/core_web/controllers/push_subscription_html.ex

This file was deleted.

2 changes: 0 additions & 2 deletions core/lib/core_web/controllers/vapid_public_key.ex

This file was deleted.

6 changes: 0 additions & 6 deletions core/lib/core_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ defmodule CoreWeb.Router do
get("/uploads/:filename", UploadedFileController, :get)
end

scope "/", CoreWeb do
pipe_through([:api, :require_authenticated_user])
get("/web-push/vapid-public-key", PushSubscriptionController, :vapid_public_key)
post("/web-push/register", PushSubscriptionController, :register)
end

if Mix.env() == :dev do
forward("/sent_emails", Bamboo.SentEmailViewerPlug)
end
Expand Down
4 changes: 4 additions & 0 deletions core/lib/core_web/ui/timestamp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ defmodule CoreWeb.UI.Timestamp do
Timex.format!(datetime, "%Y-%m-%d", :strftime)
end

def format_date_short!(datetime) do
Timex.format!(datetime, "%Y%m%d", :strftime)
end

def stamp(%DateTime{} = datetime) do
weekday = Timex.format!(datetime, "%A", :strftime)
month = Timex.format!(datetime, "%B", :strftime)
Expand Down
59 changes: 30 additions & 29 deletions core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,46 @@ defmodule Core.MixProject do
# Workaround for conflicting versions in ex_aws & ex_phone_number
{:sweet_xml, "~> 0.7", override: true},
# Deps
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
{:assent, "~> 0.2.3"},
{:bamboo_phoenix, git: "https://github.com/populimited/bamboo_phoenix.git", ref: "bf3e320"},
{:bamboo_ses, "~> 0.3.0"},
{:bamboo, "~> 2.2"},
{:bcrypt_elixir, "~> 2.0"},
{:csv, "~> 2.4"},
{:currency_formatter, "~> 0.8"},
{:ecto_commons, "~> 0.3.3"},
{:ecto_sql, "~> 3.9.2"},
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
{:ex_aws_s3, "~> 2.5"},
{:phoenix, "1.7.2"},
{:phoenix_view, "~> 2.0"},
{:phoenix_ecto, "~> 4.4"},
{:phoenix_live_view, "~> 0.20.1"},
{:phoenix_html, "~> 3.3.1"},
{:phoenix_inline_svg, "~> 1.4"},
{:faker, "~> 0.17"},
{:floki, ">= 0.27.0"},
{:ecto_sql, "~> 3.9.2"},
{:ecto_commons, "~> 0.3.3"},
{:postgrex, ">= 0.15.13"},
{:gettext, "~> 0.19"},
{:httpoison, "~> 2.2.1"},
{:jason, "~> 1.3"},
{:kadabra, "~> 0.6.0"},
{:libcluster, "~> 3.3"},
{:logger_json, "~> 4.3"},
{:mime, "~> 2.0"},
{:nimble_parsec, "~> 1.2"},
{:oban, "~> 2.13.3"},
{:packmatic, "~> 1.2.0"},
{:phoenix_ecto, "~> 4.4"},
{:phoenix_html, "~> 3.3.1"},
{:phoenix_inline_svg, "~> 1.4"},
{:phoenix_live_view, "~> 0.20.1"},
{:phoenix_view, "~> 2.0"},
{:phoenix, "1.7.2"},
{:plug_cowboy, "~> 2.5"},
{:faker, "~> 0.17"},
{:timex, "~> 3.7"},
{:bamboo, "~> 2.2"},
{:bamboo_phoenix, git: "https://github.com/populimited/bamboo_phoenix.git", ref: "bf3e320"},
{:bamboo_ses, "~> 0.3.0"},
{:postgrex, ">= 0.15.13"},
{:remote_ip, "~> 1.1"},
{:sentry, "~> 8.0"},
{:slugify, "~> 1.3"},
{:statistics, "~> 0.6.2"},
{:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:currency_formatter, "~> 0.8"},
{:web_push_encryption, "~> 0.3.1"},
{:remote_ip, "~> 1.1"},
{:pigeon, "~> 1.6.1"},
{:kadabra, "~> 0.6.0"},
{:oban, "~> 2.13.3"},
{:nimble_parsec, "~> 1.2"},
{:timex, "~> 3.7"},
{:typed_struct, "~> 0.2.1"},
{:logger_json, "~> 4.3"},
{:statistics, "~> 0.6.2"},
{:csv, "~> 2.4"},
{:sentry, "~> 8.0"},
{:libcluster, "~> 3.3"},
{:mime, "~> 2.0"},
# i18n
{:ex_cldr, "~> 2.25"},
{:ex_cldr_numbers, "~> 2.23"},
Expand Down
Loading

0 comments on commit f02acc9

Please sign in to comment.