Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move secrets to ENV #13268

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
73e44af
Move secrets to ENV
alecslupu Jul 31, 2024
8634bda
Remove more .secrets occurences
alecslupu Jul 31, 2024
91bc534
Fix failing specs
alecslupu Jul 31, 2024
012081b
Fix system
alecslupu Jul 31, 2024
f3b290c
fix specs
alecslupu Aug 1, 2024
4569e08
Fix more tests
alecslupu Aug 1, 2024
aae814f
Fix more specs
alecslupu Aug 1, 2024
ad69d2f
Refactor
alecslupu Aug 2, 2024
85acec6
Remove some secret references
alecslupu Aug 2, 2024
ce5a250
Fix Env
alecslupu Aug 2, 2024
8f52f83
fix pipeline
alecslupu Aug 2, 2024
4b08369
Merge branch 'develop' into chore/remove-secrets
alecslupu Aug 14, 2024
60641cf
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 9, 2024
8ea739d
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 17, 2024
712c0e1
Fix specs
alecslupu Sep 17, 2024
cbc94a9
Running linters
alecslupu Sep 17, 2024
54df9ea
fix spec
alecslupu Sep 17, 2024
516c4e6
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 20, 2024
1feb8b9
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 20, 2024
89a75de
Simplify env variable usage
alecslupu Sep 20, 2024
45a5b07
Fix generation
alecslupu Sep 20, 2024
7ee6849
Fix pipeline
alecslupu Sep 21, 2024
649fa9f
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 4, 2024
42878e6
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 8, 2024
85ee841
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 19, 2024
bf4a417
Fix pages spec
alecslupu Oct 19, 2024
c3377f4
Adjust omniauth_providers
alecslupu Oct 19, 2024
7f3c54f
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 30, 2024
ad0ef46
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Nov 4, 2024
bd1bbe1
Fix pipeline
alecslupu Nov 4, 2024
785df93
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 9, 2024
53c955a
Running linters
alecslupu Dec 9, 2024
1ececa0
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 13, 2024
04bf2d7
Merge branch 'develop' into chore/remove-secrets
alecslupu Dec 19, 2024
476d59c
Merge branch 'develop' into chore/remove-secrets
alecslupu Dec 23, 2024
d3ac20e
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 23, 2024
6c19db1
Merge branch 'chore/remove-secrets' of github.com:decidim/decidim int…
alecslupu Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decidim-accountability/lib/decidim/accountability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Accountability

# Public Setting that defines whether proposals can be linked to meetings
config_accessor :enable_proposal_linking do
Decidim.const_defined?("Proposals")
Decidim::Env.new("ACCOUNTABILITY_ENABLE_PROPOSAL_LINKING", Decidim.const_defined?("Proposals")).present?
end
end
end
9 changes: 5 additions & 4 deletions decidim-api/lib/decidim/api.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "decidim/env"
require "decidim/api/engine"
require "decidim/api/types"

Expand All @@ -11,21 +12,21 @@ module Api

# defines the schema max_per_page to configure GraphQL pagination
config_accessor :schema_max_per_page do
50
Decidim::Env.new("API_SCHEMA_MAX_PER_PAGE", 50).to_i
end

# defines the schema max_complexity to configure GraphQL query complexity
config_accessor :schema_max_complexity do
5000
Decidim::Env.new("API_SCHEMA_MAX_COMPLEXITY", 5000).to_i
end

# defines the schema max_depth to configure GraphQL query max_depth
config_accessor :schema_max_depth do
15
Decidim::Env.new("API_SCHEMA_MAX_DEPTH", 15).to_i
end

config_accessor :disclose_system_version do
%w(1 true yes).include?(ENV.fetch("DECIDIM_API_DISCLOSE_SYSTEM_VERSION", nil))
Decidim::Env.new("DECIDIM_API_DISCLOSE_SYSTEM_VERSION").present?
end

# This declares all the types an interface or union can resolve to. This needs
Expand Down
2 changes: 1 addition & 1 deletion decidim-budgets/lib/decidim/budgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Budgets

# Public Setting that defines whether proposals can be linked to meetings
config_accessor :enable_proposal_linking do
Decidim.const_defined?("Proposals")
Decidim::Env.new("BUDGETS_ENABLE_PROPOSAL_LINKING", Decidim.const_defined?("Proposals")).present?
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def direct_message_types
end

def meet_push_notifications_requirements?
Rails.application.secrets.dig(:vapid, :enabled) || false
Decidim::Env.new("VAPID_PUBLIC_KEY", nil).present?
end
end
end
2 changes: 1 addition & 1 deletion decidim-core/app/models/decidim/omniauth_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Decidim
class OmniauthProvider
def self.available
Rails.application.secrets[:omniauth] || {}
Decidim.omniauth_providers
end

def self.enabled
Expand Down
6 changes: 3 additions & 3 deletions decidim-core/app/services/decidim/send_push_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SendPushNotification
#
# @return [Array<Net::HTTPCreated>, nil] the result of the dispatch or nil if user or subscription are empty
def perform(notification, title = nil)
return unless Rails.application.secrets.dig(:vapid, :enabled)
return if Decidim::Env.new("VAPID_PUBLIC_KEY").blank?
raise ArgumentError, "Need to provide a title if the notification is a PushNotificationMessage" if notification.is_a?(Decidim::PushNotificationMessage) && title.nil?

user = notification.user
Expand Down Expand Up @@ -66,8 +66,8 @@ def build_payload(message_params, subscription)
p256dh: subscription["p256dh"],
auth: subscription["auth"],
vapid: {
public_key: Rails.application.secrets.vapid[:public_key],
private_key: Rails.application.secrets.vapid[:private_key]
public_key: ENV.fetch("VAPID_PUBLIC_KEY", nil),
private_key: ENV.fetch("VAPID_PRIVATE_KEY", nil)
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
</div>
</div>

<input id="vapidPublicKey" name="vapid_public_key" type="hidden" value="<%= Base64.urlsafe_decode64(Rails.application.secrets.vapid[:public_key]).bytes %>">
<input id="vapidPublicKey" name="vapid_public_key" type="hidden" value="<%= Base64.urlsafe_decode64(Decidim::Env.new("VAPID_PUBLIC_KEY", nil).to_s).bytes %>">
<input id="subKeys" name="sub_key" type="hidden" value="<%= current_user.notifications_subscriptions.keys %>">
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion decidim-core/config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setup_provider_proc(provider, config_mapping = {})
end

Rails.application.config.middleware.use OmniAuth::Builder do
omniauth_config = Rails.application.secrets[:omniauth]
omniauth_config = Decidim.omniauth_providers

if omniauth_config
if omniauth_config[:developer].present?
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/lib/decidim/asset_router/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def default_options
# @return [Hash] The remote storage options hash
def remote_storage_options
@remote_storage_options ||= {
host: Rails.application.secrets.dig(:storage, :cdn_host)
host: ENV.fetch("STORAGE_CDN_HOST", nil)
}.compact
end

Expand Down
Loading
Loading