feat: migrate facebook env vars to globalConfig (#3369)

Migrate facebook env vars to globalConfig and make it editable from the super admin UI.
This commit is contained in:
Vishnu Narayanan
2021-11-25 00:55:26 +05:30
committed by GitHub
parent c23e2c23d4
commit 3a48e08fe0
8 changed files with 26 additions and 12 deletions

View File

@@ -19,6 +19,9 @@ describe VapidService do
ENV['VAPID_PUBLIC_KEY'] = 'test'
described_class.public_key
# this call will hit db as after_commit method will clear globalConfig cache
expect(InstallationConfig).to receive(:find_by)
described_class.public_key
# subsequent calls should not hit DB
expect(InstallationConfig).not_to receive(:find_by)
described_class.public_key
@@ -30,11 +33,13 @@ describe VapidService do
ENV['VAPID_PRIVATE_KEY'] = 'test'
described_class.private_key
# this call will hit db as after_commit method will clear globalConfig cache
expect(InstallationConfig).to receive(:find_by)
described_class.private_key
# subsequent calls should not hit DB
expect(InstallationConfig).not_to receive(:find_by)
described_class.private_key
ENV['VAPID_PRIVATE_KEY'] = nil
ENV['VAPID_PRIVATE_KEY'] = nil
end
it 'clears cache and fetch from DB next time, when clear_cache is called' do