Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
refactor(config): cache repetitive calls to conf.get
Browse files Browse the repository at this point in the history
  • Loading branch information
philbooth committed Mar 26, 2019
1 parent c74df5a commit ef54799
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,18 +893,19 @@ conf.validate({ allowed: 'strict' });
conf.set('domain', url.parse(conf.get('publicUrl')).host);

// derive fxa-auth-mailer configuration from our content-server url
conf.set('smtp.accountSettingsUrl', `${conf.get('contentServer.url') }/settings`);
conf.set('smtp.accountRecoveryCodesUrl', `${conf.get('contentServer.url') }/settings/two_step_authentication/recovery_codes`);
conf.set('smtp.verificationUrl', `${conf.get('contentServer.url') }/verify_email`);
conf.set('smtp.passwordResetUrl', `${conf.get('contentServer.url') }/complete_reset_password`);
conf.set('smtp.initiatePasswordResetUrl', `${conf.get('contentServer.url') }/reset_password`);
conf.set('smtp.initiatePasswordChangeUrl', `${conf.get('contentServer.url') }/settings/change_password`);
conf.set('smtp.verifyLoginUrl', `${conf.get('contentServer.url') }/complete_signin`);
conf.set('smtp.reportSignInUrl', `${conf.get('contentServer.url') }/report_signin`);
conf.set('smtp.revokeAccountRecoveryUrl', `${conf.get('contentServer.url') }/settings/account_recovery/confirm_revoke`);
conf.set('smtp.createAccountRecoveryUrl', `${conf.get('contentServer.url') }/settings/account_recovery/confirm_password`);
conf.set('smtp.verifyPrimaryEmailUrl', `${conf.get('contentServer.url') }/verify_primary_email`);
conf.set('smtp.verifySecondaryEmailUrl', `${conf.get('contentServer.url') }/verify_secondary_email`);
const baseUri = conf.get('contentServer.url');
conf.set('smtp.accountSettingsUrl', `${baseUri}/settings`);
conf.set('smtp.accountRecoveryCodesUrl', `${baseUri}/settings/two_step_authentication/recovery_codes`);
conf.set('smtp.verificationUrl', `${baseUri}/verify_email`);
conf.set('smtp.passwordResetUrl', `${baseUri}/complete_reset_password`);
conf.set('smtp.initiatePasswordResetUrl', `${baseUri}/reset_password`);
conf.set('smtp.initiatePasswordChangeUrl', `${baseUri}/settings/change_password`);
conf.set('smtp.verifyLoginUrl', `${baseUri}/complete_signin`);
conf.set('smtp.reportSignInUrl', `${baseUri}/report_signin`);
conf.set('smtp.revokeAccountRecoveryUrl', `${baseUri}/settings/account_recovery/confirm_revoke`);
conf.set('smtp.createAccountRecoveryUrl', `${baseUri}/settings/account_recovery/confirm_password`);
conf.set('smtp.verifyPrimaryEmailUrl', `${baseUri}/verify_primary_email`);
conf.set('smtp.verifySecondaryEmailUrl', `${baseUri}/verify_secondary_email`);

conf.set('isProduction', conf.get('env') === 'prod');

Expand Down

0 comments on commit ef54799

Please sign in to comment.