Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Conversation

@al2o3cr
Copy link

@al2o3cr al2o3cr commented Jun 29, 2020

Moves all Samly config to live under a particular OTP app, for use in umbrellas with multiple web frontends.

To wire this up, pass otp_app: SomeOtpApp when starting Samly.Provider and to the Samly.Router plug.

TODO: is there a use case for multiple SPs in one Phoenix app, or should this be a singleton config? Could tidy up some things (no sp_id etc)

end

defp config_samly(conn, opts) do
opts = Keyword.put_new(opts, :otp_app, :samly)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default will ensure that unmodified apps continue working as before

idp_id_from = Application.get_env(:samly, :idp_id_from)
otp_app = conn.private[:samly_config][:otp_app]

idp_id_from = Application.get_env(otp_app, Samly.Config).idp_id_from
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: is it better to do these get_envs all over, or set the whole config in conn.private?

Application.get_env(otp_app, Samly.Config, %{})
|> Map.put(:state_store, value)

Application.put_env(otp_app, Samly.Config, new_config)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: if this is a pattern worth keeping, consider encapsulating it in a module

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants