Skip to content

Commit

Permalink
[infra] boruta federation application deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
patatoid committed Nov 1, 2024
1 parent 2f40f30 commit df199df
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/boruta_federation/lib/boruta_federation/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@ defmodule BorutaFederation.Application do
]

opts = [strategy: :one_for_one, name: BorutaFederation.Supervisor]

setup_database()
Supervisor.start_link(children, opts)
end

def setup_database do
Enum.each([BorutaFederation.Repo], fn repo ->
repo.__adapter__.storage_up(repo.config)
end)

Enum.each([BorutaFederation.Repo], fn repo ->
Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end)

:ok
end

@impl true
def config_change(changed, _new, removed) do
BorutaFederationWeb.Endpoint.config_change(changed, removed)
Expand Down
11 changes: 11 additions & 0 deletions config/releases.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ config :boruta_admin, BorutaAdmin.Repo,
hostname: System.get_env("POSTGRES_HOST") || "localhost",
pool_size: 1

config :boruta_federation, BorutaFederation.Repo,
username: System.get_env("POSTGRES_USER") || "postgres",
password: System.get_env("POSTGRES_PASSWORD") || "postgres",
database: System.get_env("POSTGRES_DATABASE") || "boruta_admin",
hostname: System.get_env("POSTGRES_HOST") || "localhost",
pool_size: 1

config :boruta_identity, Boruta.Accounts, secret_key_base: System.get_env("SECRET_KEY_BASE")

config :boruta_identity, BorutaIdentity.SMTP, adapter: Swoosh.Adapters.SMTP
Expand All @@ -62,6 +69,10 @@ config :boruta_identity, BorutaIdentityWeb.Endpoint,
url: [scheme: System.get_env("BORUTA_OAUTH_SCHEME", "https"), host: System.get_env("BORUTA_OAUTH_HOST"), path: "/accounts", port: System.get_env("BORUTA_OAUTH_PORT")],
secret_key_base: System.get_env("SECRET_KEY_BASE")

config :boruta_federation, BorutaFederationWeb.Endpoint,
url: [scheme: System.get_env("BORUTA_OAUTH_SCHEME", "https"), host: System.get_env("BORUTA_OAUTH_HOST"), path: "/accounts", port: System.get_env("BORUTA_OAUTH_PORT")],
secret_key_base: System.get_env("SECRET_KEY_BASE")

config :boruta_admin, BorutaAdminWeb.Endpoint,
http: [
port: System.get_env("BORUTA_ADMIN_PORT") |> String.to_integer(),
Expand Down

0 comments on commit df199df

Please sign in to comment.