-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove global env variables from organizations (#2016)
Closes #1947 @soey there is still the `three_sixty_dialog_partner_token` attribute that lives at the organization level, which it probably shouldn't. This is also a value that is global and is not unique to the organization. The token is only good for 24 hours, which makes it difficult to get the value from env variables. Previously, with `rails-settings-cached`, we would save the value to the db in the `settings` table and then check to see if there was a value and that it had been updated within 24 hours before asking for a new token, or using the valid one. Currently, this is used for creating the api key for a newly onboarded client. It then is used to create the templates needed to send out messages for that client. I think a better way to handle this would be to assume the token is not valid, if it even exists, since we are unlikely to be onboarding multiple clients in the same 24-hour period and always ask for a new token when we run the create api key job. The create template job is currently called from a rake task that collects the templates from our `de.yml` before scheduling the job. We would need to rethink this flow if we wanted to be able to use the same token to create the templates.
- Loading branch information
Showing
6 changed files
with
55 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
db/migrate/20240905104347_remove_global_env_variables_from_organizations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
class RemoveGlobalEnvVariablesFromOrganizations < ActiveRecord::Migration[6.1] | ||
def change | ||
change_table :organizations, bulk: true do |t| | ||
t.remove :three_sixty_dialog_partner_id, type: :string | ||
t.remove :three_sixty_dialog_partner_username, type: :string | ||
t.remove :encrypted_three_sixty_dialog_partner_password, type: :string | ||
t.remove :encrypted_three_sixty_dialog_partner_password_iv, type: :string | ||
t.remove :encrypted_three_sixty_dialog_partner_token, type: :string | ||
t.remove :encrypted_three_sixty_dialog_partner_token_iv, type: :string | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.