Nixos module

This commit is contained in:
bluepython508
2023-11-09 23:58:26 +00:00
parent 21ad6931b7
commit e58fe69747
6 changed files with 110 additions and 14 deletions

View File

@@ -54,4 +54,8 @@ config :phoenix, :json_library, Jason
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
config :wax_, origin: "http://localhost:4000", rp_id: :auto
config :boruta, Boruta.Oauth, repo: SsoBsn.Repo, issuer: "http://localhost:4000/", contexts: [ resource_owners: SsoBsnWeb.ResourceOwners ]
import_config "#{config_env()}.exs"

View File

@@ -26,7 +26,6 @@ config :sso_bsn, SsoBsnWeb.Endpoint,
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
]
config :sso_bsn, :session_domain, "localhost"
# ## SSL Support
#
@@ -77,5 +76,6 @@ config :phoenix, :plug_init_mode, :runtime
# Include HEEx debug annotations as HTML comments in rendered markup
config :phoenix_live_view, :debug_heex_annotations, true
config :wax_, origin: "http://localhost:4000", rp_id: :auto
config :boruta, Boruta.Oauth, repo: SsoBsn.Repo, issuer: "http://localhost:4000/", contexts: [ resource_owners: SsoBsnWeb.ResourceOwners ]
config :wax_, origin: "http://localhost:4000"
config :boruta, Boruta.Oauth, issuer: "http://localhost:4000/"
config :sso_bsn, :session_domain, "localhost"

View File

@@ -16,7 +16,7 @@ import Config
#
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above.
if System.get_env("PHX_SERVER") do
if System.get_env("SERVER") do
config :sso_bsn, SsoBsnWeb.Endpoint, server: true
end
@@ -44,20 +44,22 @@ if config_env() == :prod do
You can generate one by calling: mix phx.gen.secret
"""
host = System.get_env("PHX_HOST") || "example.com"
port = String.to_integer(System.get_env("PORT") || "4000")
host = System.get_env("SSO_BSN_HOST") || raise "SSO_BSN_HOST must be set to the external host of the service"
config :wax_, origin: "https://#{host}/"
config :boruta, Boruta.Oauth, issuer: "https://#{host}/"
config :sso_bsn, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
config :sso_bsn, :session_domain, System.get_env("SESSION_DOMAIN") # A nil value will allow browser default of no subdomains, current domain
sock = System.get_env("BIND_UNIX") || raise "BIND_UNIX must be a path to a unix socket"
config :sso_bsn, SsoBsnWeb.Endpoint,
url: [host: host, port: 443, scheme: "https"],
http: [
# Enable IPv6 and bind on all interfaces.
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: port
ip: {:local, sock},
port: 0
],
secret_key_base: secret_key_base