diff --git a/.github/workflows/fly.yml b/.github/workflows/fly.yml index ff680179..8af944fb 100644 --- a/.github/workflows/fly.yml +++ b/.github/workflows/fly.yml @@ -13,6 +13,8 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.workflow_run.head_branch }} - uses: superfly/flyctl-actions/setup-flyctl@master - run: flyctl deploy --remote-only env: diff --git a/config/runtime.exs b/config/runtime.exs index 6252f1f3..40e3b90a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -63,6 +63,16 @@ if config_env() == :prod do ], secret_key_base: secret_key_base + # Authentication config + google_client_id = + System.get_env("GOOGLE_CLIENT_ID") || + raise """ + environment variable GOOGLE_CLIENT_ID is missing. + For example: 00000-asdf000.apps.googleusercontent.com + """ + + config :lanttern, LantternWeb.UserAuth, google_client_id: google_client_id + # ## SSL Support # # To get SSL working, you will need to add the `https` key diff --git a/lib/lanttern/google_token.ex b/lib/lanttern/google_token.ex index 25d7cafc..8a3d9e23 100644 --- a/lib/lanttern/google_token.ex +++ b/lib/lanttern/google_token.ex @@ -8,7 +8,7 @@ defmodule Lanttern.GoogleToken do def token_config do client_id = - Application.get_env(:lanttern, LantternWeb.UserAuth) + Application.fetch_env!(:lanttern, LantternWeb.UserAuth) |> Keyword.get(:google_client_id) %{} diff --git a/lib/lanttern_web/live/user_login_live.ex b/lib/lanttern_web/live/user_login_live.ex index b0a31b34..71816b5d 100644 --- a/lib/lanttern_web/live/user_login_live.ex +++ b/lib/lanttern_web/live/user_login_live.ex @@ -65,7 +65,7 @@ defmodule LantternWeb.UserLoginLive do form = to_form(%{"email" => email}, as: "user") google_client_id = - Application.get_env(:lanttern, LantternWeb.UserAuth) + Application.fetch_env!(:lanttern, LantternWeb.UserAuth) |> Keyword.get(:google_client_id) socket =