Skip to content

Commit

Permalink
Rename seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Oct 15, 2024
1 parent 2bc4704 commit 44cbe48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module EnvData
module OpenIDConnect
class ProviderSeeder < Seeder
def seed_data!
Setting.seed_openid_connect_provider.each do |name, configuration|
Setting.seed_oidc_provider.each do |name, configuration|
print_status " ↳ Creating or Updating OpenID provider #{name}" do
call = ::OpenIDConnect::SyncService.new(name, configuration).call

Expand All @@ -45,7 +45,7 @@ def seed_data!
end

def applicable?
Setting.seed_openid_connect_provider.present?
Setting.seed_oidc_provider.present?
end
end
end
Expand Down
9 changes: 0 additions & 9 deletions modules/openid_connect/lib/open_project/openid_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

module OpenProject
module OpenIDConnect
CONFIG_KEY = :seed_openid_connect_provider
CONFIG_OPTIONS = {
description: "Provide a OpenIDConnect provider and sync its settings through ENV",
env_alias: "OPENPROJECT_OPENID__CONNECT",
default: {},
writable: false,
format: :hash
}.freeze

def providers
# update base redirect URI in case settings changed
::OmniAuth::OpenIDConnect::Providers.configure(
Expand Down
16 changes: 9 additions & 7 deletions modules/openid_connect/lib/open_project/openid_connect/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ class Engine < ::Rails::Engine
end
end

initializer "openid_connect.configure" do
::Settings::Definition.add(
OpenProject::OpenIDConnect::CONFIG_KEY,
**OpenProject::OpenIDConnect::CONFIG_OPTIONS
)
end

initializer "openid_connect.form_post_method" do
# If response_mode 'form_post' is chosen,
# the IP sends a POST to the callback. Only if
Expand All @@ -81,6 +74,15 @@ class Engine < ::Rails::Engine
end
end

initializer "openid_connect.configuration" do
::Settings::Definition.add :seed_oidc_provider,
description: "Provide a OIDC provider and sync its settings through ENV",
env_alias: "OPENPROJECT_OIDC",
writable: false,
default: {},
format: :hash
end

config.to_prepare do
::OpenProject::OpenIDConnect::Hooks::Hook
end
Expand Down

0 comments on commit 44cbe48

Please sign in to comment.