From 2f3100324b8dbc727ccbf87fb8942ed1906717c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lui=CC=81s=20Arteiro?= Date: Thu, 8 Feb 2024 01:28:41 +0000 Subject: [PATCH] feat: Adding way to add callback path in config files. --- README.md | 6 ++++++ demo/lib/app_web/microsoft_auth.ex | 2 +- lib/elixir_auth_microsoft.ex | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1dbe61..1218d78 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,12 @@ get "/auth/microsoft/callback", MicrosoftAuthController, :index With all that hooked up you should now have everything working. +> [!NOTE] +> +> You can define your callback path with an environment variable +> `MICROSOFT_CALLBACK_PATH` +> or by using the config property `:callback_path` in your config files. + ### 6.1 Give it a try! The home page of the app diff --git a/demo/lib/app_web/microsoft_auth.ex b/demo/lib/app_web/microsoft_auth.ex index 4689bb3..cfad462 100644 --- a/demo/lib/app_web/microsoft_auth.ex +++ b/demo/lib/app_web/microsoft_auth.ex @@ -159,7 +159,7 @@ defmodule ElixirAuthMicrosoft do end defp get_callback_path do - System.get_env("MICROSOFT_CALLBACK_PATH") || @default_callback_path + System.get_env("MICROSOFT_CALLBACK_PATH") || Application.get_env(:elixir_auth_microsoft, :callback_path) || @default_callback_path end diff --git a/lib/elixir_auth_microsoft.ex b/lib/elixir_auth_microsoft.ex index 80b0012..97baf03 100644 --- a/lib/elixir_auth_microsoft.ex +++ b/lib/elixir_auth_microsoft.ex @@ -161,7 +161,7 @@ defmodule ElixirAuthMicrosoft do end defp get_callback_path do - System.get_env("MICROSOFT_CALLBACK_PATH") || @default_callback_path + System.get_env("MICROSOFT_CALLBACK_PATH") || Application.get_env(:elixir_auth_microsoft, :callback_path) || @default_callback_path end