diff --git a/config/dev.exs b/config/dev.exs index 8b5380b0..fa80e42d 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -2,6 +2,16 @@ import Config # Configure your database if System.get_env("FLEETYARDS_IN_DEVENV") == "1" do + config :ex_fleet_yards_web, ExFleetYardsWeb.Endpoint, + url: [host: "fleetyards.localhost", port: 8443, scheme: "https"] + + config :ex_fleet_yards_api, ExFleetYardsApi.Endpoint, + url: [host: "api.fleetyards.localhost", port: 8443, scheme: "https"] + + config :ex_fleet_yards_auth, ExFleetYardsAuth.Endpoint, + url: [host: "auth.fleetyards.localhost", port: 8443, scheme: "https"] + + config :boruta, Boruta.Oauth, issuer: "https://auth.fleetyards.net" else config :ex_fleet_yards, ExFleetYards.Repo, username: "fleet_yards_dev", diff --git a/flake.nix b/flake.nix index 379b02bd..8369e984 100644 --- a/flake.nix +++ b/flake.nix @@ -122,6 +122,36 @@ services.postgres.initialDatabases = [{ name = "fleet_yards_dev"; }]; } + ({ config, ... }: { + certificates = [ + "fleetyards.localhost" + "api.fleetyards.localhost" + "auth.fleetyards.localhost" + ]; + + services.caddy.enable = true; + services.caddy.config = '' + { + auto_https disable_redirects + } + ''; + services.caddy.virtualHosts = let + elixir_host = port: { + extraConfig = '' + tls ${config.devenv.state}/mkcert/fleetyards.localhost+2.pem ${config.devenv.state}/mkcert/fleetyards.localhost+2-key.pem + + reverse_proxy * http://localhost:${toString port} + ''; + }; + tls = name: '' + tls ${config.devenv.state}/mkcert/fleetyards.localhost+2.pem ${config.devenv.state}/mkcert/fleetyards.localhost+2-key.pem + auto_https disable_redirects''; + #"tls ${config.devenv.state}/mkcert/${name}.pem ${config.devenv.state}/mkcert/${name}-key.pem"; + in { + "fleetyards.localhost:8443" = elixir_host 4000; + "auth.fleetyards.localhost:8443" = elixir_host 4002; + }; + }) ({ config, ... }: { process.implementation = "hivemind"; scripts.devenv-up.exec = ''