diff --git a/config/config.exs b/config/config.exs index 1c706b9..f633469 100644 --- a/config/config.exs +++ b/config/config.exs @@ -8,9 +8,7 @@ import Config config :waffle, - storage: Waffle.Storage.S3, - bucket: "mixer-bucket", - asset_host: "http://localhost:9000" + storage: Waffle.Storage.S3 config :ex_aws, json_codec: Jason diff --git a/config/dev.exs b/config/dev.exs index 457c221..047324d 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -102,3 +102,7 @@ config :ex_aws, :s3, host: "localhost", port: 9000, virtual_host: false + +config :waffle, + bucket: "mixer-bucket", + asset_host: "http://localhost:9000" diff --git a/config/runtime.exs b/config/runtime.exs index 3e1a900..64f13a8 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -72,6 +72,31 @@ if config_env() == :prod do System.get_env("TOKEN_SIGNING_SECRET") || raise("Missing environment variable `TOKEN_SIGNING_SECRET`!") + # Configure S3-compatible storage (MinIO/Garege/AWS S3) + config :ex_aws, + access_key_id: + System.get_env("S3_ACCESS_KEY_ID") || + raise("Missing environment variable `S3_ACCESS_KEY_ID`!"), + secret_access_key: + System.get_env("S3_SECRET_ACCESS_KEY") || + raise("Missing environment variable `S3_SECRET_ACCESS_KEY`!") + + config :ex_aws, :s3, + scheme: System.get_env("S3_SCHEME", "https://"), + host: + System.get_env("S3_HOST") || + raise("Missing environment variable `S3_HOST`!"), + port: String.to_integer(System.get_env("S3_PORT", "80")), + virtual_host: System.get_env("S3_VIRTUAL_HOST", "false") == "true" + + config :waffle, + bucket: + System.get_env("S3_BUCKET") || + raise("Missing environment variable `S3_BUCKET`!"), + asset_host: + System.get_env("S3_ASSET_HOST") || + raise("Missing environment variable `S3_ASSET_HOST`!") + # ## SSL Support # # To get SSL working, you will need to add the `https` key