2013-07-26 05:46:16 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-05-13 03:48:26 +03:00
|
|
|
require('envc')()
|
|
|
|
|
2013-07-23 22:16:44 +04:00
|
|
|
var fs = require('fs')
|
|
|
|
var path = require('path')
|
|
|
|
var url = require('url')
|
|
|
|
var convict = require('convict')
|
2015-05-10 22:11:59 +03:00
|
|
|
var DEFAULT_SUPPORTED_LANGUAGES = require('./supportedLanguages')
|
2013-07-23 22:16:44 +04:00
|
|
|
|
2015-05-10 22:11:59 +03:00
|
|
|
var conf = convict({
|
|
|
|
env: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'The current node.js environment',
|
|
|
|
default: 'prod',
|
|
|
|
format: [ 'dev', 'test', 'stage', 'prod' ],
|
2015-05-10 22:11:59 +03:00
|
|
|
env: 'NODE_ENV'
|
|
|
|
},
|
2016-07-29 22:41:08 +03:00
|
|
|
geodb: {
|
|
|
|
dbPath: {
|
|
|
|
doc: 'Path to the maxmind database file',
|
|
|
|
default: path.resolve(__dirname, '../node_modules/fxa-geodb/db/cities-db.mmdb'),
|
|
|
|
env: 'GEODB_DBPATH',
|
|
|
|
format: String
|
|
|
|
},
|
|
|
|
enabled: {
|
|
|
|
doc: 'kill-switch for geodb',
|
|
|
|
default: true,
|
|
|
|
env: 'GEODB_ENABLED',
|
|
|
|
format: Boolean
|
|
|
|
}
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
log: {
|
|
|
|
level: {
|
|
|
|
default: 'info',
|
|
|
|
env: 'LOG_LEVEL'
|
2015-12-29 19:11:55 +03:00
|
|
|
},
|
|
|
|
fmt: {
|
|
|
|
format: ['heka', 'pretty'],
|
|
|
|
default: 'heka',
|
|
|
|
env: 'LOG_FORMAT'
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
},
|
2016-06-27 13:02:10 +03:00
|
|
|
memcached: {
|
|
|
|
address: {
|
|
|
|
doc: 'Address:port of the memcached server (or `none` to disable memcached)',
|
|
|
|
default: '127.0.0.1:11211',
|
|
|
|
env: 'MEMCACHE_METRICS_CONTEXT_ADDRESS'
|
|
|
|
},
|
|
|
|
idle: {
|
|
|
|
doc: 'Idle timeout for memcached connections (milliseconds)',
|
|
|
|
format: Number,
|
|
|
|
default: 30000,
|
|
|
|
env: 'MEMCACHE_METRICS_CONTEXT_IDLE'
|
|
|
|
},
|
|
|
|
lifetime: {
|
|
|
|
doc: 'Lifetime for memcached values (seconds)',
|
|
|
|
format: 'nat',
|
2016-10-23 16:10:40 +03:00
|
|
|
default: 7200,
|
2016-06-27 13:02:10 +03:00
|
|
|
env: 'MEMCACHE_METRICS_CONTEXT_LIFETIME'
|
|
|
|
}
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
publicUrl: {
|
2015-06-19 02:12:42 +03:00
|
|
|
format: 'url',
|
|
|
|
default: 'http://127.0.0.1:9000',
|
|
|
|
env: 'PUBLIC_URL'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
2015-06-10 04:36:32 +03:00
|
|
|
domain: {
|
2015-06-19 02:12:42 +03:00
|
|
|
format: 'url',
|
|
|
|
doc: 'Derived automatically from publicUrl',
|
2015-06-10 04:36:32 +03:00
|
|
|
default: undefined
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
secretKeyFile: {
|
2015-05-13 03:48:26 +03:00
|
|
|
format: String,
|
|
|
|
default: path.resolve(__dirname, '../config/secret-key.json'),
|
|
|
|
env: 'SECRET_KEY_FILE'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
|
|
|
publicKeyFile: {
|
2015-05-13 03:48:26 +03:00
|
|
|
format: String,
|
|
|
|
default: path.resolve(__dirname, '../config/public-key.json'),
|
|
|
|
env: 'PUBLIC_KEY_FILE'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
2015-09-22 03:14:23 +03:00
|
|
|
oldPublicKeyFile: {
|
|
|
|
format: String,
|
|
|
|
doc: 'Previous publicKeyFile, used for key rotation',
|
|
|
|
default: undefined,
|
|
|
|
env: 'OLD_PUBLIC_KEY_FILE'
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
trustedJKUs: {
|
2015-05-13 03:48:26 +03:00
|
|
|
format: Array,
|
|
|
|
default: [],
|
|
|
|
env: 'TRUSTED_JKUS'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
2016-10-10 04:40:45 +03:00
|
|
|
vapidKeysFile: {
|
|
|
|
doc: 'Keys to use for VAPID in push notifications',
|
|
|
|
format: String,
|
|
|
|
default: path.resolve(__dirname, '../config/vapid-keys.json'),
|
|
|
|
env: 'VAPID_KEYS_FILE'
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
db: {
|
|
|
|
backend: {
|
2015-06-19 02:12:42 +03:00
|
|
|
default: 'httpdb',
|
2015-05-10 22:11:59 +03:00
|
|
|
env: 'DB_BACKEND'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
httpdb: {
|
|
|
|
url: {
|
|
|
|
doc: 'database api url',
|
2015-05-13 03:48:26 +03:00
|
|
|
default: 'http://127.0.0.1:8000',
|
|
|
|
env: 'HTTPDB_URL'
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
listen: {
|
|
|
|
host: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'The ip address the server should bind',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: '127.0.0.1',
|
|
|
|
format: 'ipaddress',
|
|
|
|
env: 'IP_ADDRESS'
|
|
|
|
},
|
|
|
|
port: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'The port the server should bind',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: 9000,
|
|
|
|
format: 'port',
|
|
|
|
env: 'PORT'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
customsUrl: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'fraud / abuse server url',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: 'http://127.0.0.1:7000',
|
|
|
|
env: 'CUSTOMS_SERVER_URL'
|
|
|
|
},
|
|
|
|
contentServer: {
|
|
|
|
url: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'The url of the corresponding fxa-content-server instance',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: 'http://127.0.0.1:3030',
|
|
|
|
env: 'CONTENT_SERVER_URL'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
smtp: {
|
|
|
|
api: {
|
|
|
|
host: {
|
|
|
|
doc: 'host for test/mail_helper.js',
|
|
|
|
default: '127.0.0.1',
|
|
|
|
env: 'MAILER_HOST'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
doc: 'port for test/mail_helper.js',
|
|
|
|
default: 9001,
|
|
|
|
env: 'MAILER_PORT'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
doc: 'SMTP host for sending email',
|
|
|
|
default: 'localhost',
|
|
|
|
env: 'SMTP_HOST'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
doc: 'SMTP port',
|
|
|
|
default: 25,
|
|
|
|
env: 'SMTP_PORT'
|
|
|
|
},
|
|
|
|
secure: {
|
|
|
|
doc: 'Connect to SMTP host securely',
|
|
|
|
default: false,
|
|
|
|
env: 'SMTP_SECURE'
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
doc: 'SMTP username',
|
|
|
|
format: String,
|
|
|
|
default: undefined,
|
|
|
|
env: 'SMTP_USER'
|
|
|
|
},
|
|
|
|
password: {
|
|
|
|
doc: 'SMTP password',
|
|
|
|
format: String,
|
|
|
|
default: undefined,
|
|
|
|
env: 'SMTP_PASS'
|
|
|
|
},
|
|
|
|
sender: {
|
|
|
|
doc: 'email address of the sender',
|
|
|
|
default: 'Firefox Accounts <no-reply@lcip.org>',
|
|
|
|
env: 'SMTP_SENDER'
|
|
|
|
},
|
|
|
|
verificationUrl: {
|
|
|
|
doc: 'Deprecated. uses contentServer.url',
|
|
|
|
format: String,
|
|
|
|
default: undefined,
|
|
|
|
env: 'VERIFY_URL',
|
|
|
|
arg: 'verify-url'
|
|
|
|
},
|
2016-04-14 08:30:11 +03:00
|
|
|
verifyLoginUrl: {
|
|
|
|
doc: 'Deprecated. uses contentServer.url',
|
|
|
|
format: String,
|
|
|
|
default: undefined,
|
|
|
|
env: 'VERIFY_LOGIN_URL',
|
|
|
|
arg: 'verify-login-url'
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
passwordResetUrl: {
|
|
|
|
doc: 'Deprecated. uses contentServer.url',
|
|
|
|
format: String,
|
|
|
|
default: undefined,
|
|
|
|
env: 'RESET_URL',
|
|
|
|
arg: 'reset-url'
|
|
|
|
},
|
2015-02-22 15:43:01 +03:00
|
|
|
initiatePasswordResetUrl: {
|
|
|
|
doc: 'Deprecated. uses contentServer.url',
|
|
|
|
format: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
2015-08-28 00:07:00 +03:00
|
|
|
syncUrl: {
|
|
|
|
doc: 'url to Sync product page',
|
|
|
|
format: String,
|
2016-02-23 19:04:02 +03:00
|
|
|
default: 'https://www.mozilla.org/firefox/sync/'
|
2015-08-28 00:07:00 +03:00
|
|
|
},
|
|
|
|
androidUrl: {
|
|
|
|
doc: 'url to Android product page',
|
|
|
|
format: String,
|
2016-02-23 19:04:02 +03:00
|
|
|
default: 'https://www.mozilla.org/firefox/android/'
|
2015-08-28 00:07:00 +03:00
|
|
|
},
|
|
|
|
iosUrl: {
|
|
|
|
doc: 'url to IOS product page',
|
|
|
|
format: String,
|
2016-02-23 19:04:02 +03:00
|
|
|
default: 'https://www.mozilla.org/firefox/ios/'
|
2015-08-28 00:07:00 +03:00
|
|
|
},
|
|
|
|
supportUrl: {
|
|
|
|
doc: 'url to Mozilla Support product page',
|
|
|
|
format: String,
|
2015-11-12 00:07:03 +03:00
|
|
|
default: 'https://support.mozilla.org/kb/im-having-problems-with-my-firefox-account'
|
2015-08-28 00:07:00 +03:00
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
redirectDomain: {
|
|
|
|
doc: 'Domain that mail urls are allowed to redirect to',
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
default: 'firefox.com',
|
|
|
|
env: 'REDIRECT_DOMAIN'
|
2016-08-05 19:49:44 +03:00
|
|
|
},
|
|
|
|
privacyUrl: {
|
|
|
|
doc: 'url to Mozilla privacy page',
|
|
|
|
format: String,
|
|
|
|
default: 'https://www.mozilla.org/privacy'
|
|
|
|
},
|
|
|
|
passwordManagerInfoUrl: {
|
|
|
|
doc: 'url to Firefox password manager information',
|
|
|
|
format: String,
|
|
|
|
default: 'https://support.mozilla.org/kb/password-manager-remember-delete-change-and-import#w_viewing-and-deleting-passwords'
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
},
|
2015-05-20 08:09:01 +03:00
|
|
|
maxEventLoopDelay: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'Max event-loop delay before which incoming requests are rejected',
|
2015-05-20 08:09:01 +03:00
|
|
|
default: 0,
|
|
|
|
env: 'MAX_EVENT_LOOP_DELAY'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
|
|
|
scrypt: {
|
|
|
|
maxPending: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'Max number of scrypt hash operations that can be pending',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: 0,
|
|
|
|
env: 'SCRYPT_MAX_PENDING'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
i18n: {
|
|
|
|
defaultLanguage: {
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
default: 'en',
|
|
|
|
env: 'DEFAULT_LANG'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
|
|
|
supportedLanguages: {
|
2015-05-13 03:48:26 +03:00
|
|
|
format: Array,
|
|
|
|
default: DEFAULT_SUPPORTED_LANGUAGES,
|
|
|
|
env: 'SUPPORTED_LANGS'
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
tokenLifetimes: {
|
|
|
|
accountResetToken: {
|
2015-07-14 19:37:14 +03:00
|
|
|
format: 'duration',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'ACCOUNT_RESET_TOKEN_TTL',
|
2015-07-14 19:37:14 +03:00
|
|
|
default: '15 minutes'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
|
|
|
passwordForgotToken: {
|
2015-07-14 19:37:14 +03:00
|
|
|
format: 'duration',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'PASSWORD_FORGOT_TOKEN_TTL',
|
2015-07-14 19:37:14 +03:00
|
|
|
default: '60 minutes'
|
2015-05-10 22:11:59 +03:00
|
|
|
},
|
|
|
|
passwordChangeToken: {
|
2015-07-14 19:37:14 +03:00
|
|
|
format: 'duration',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'PASSWORD_CHANGE_TOKEN_TTL',
|
2015-07-14 19:37:14 +03:00
|
|
|
default: '15 minutes'
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
verifierVersion: {
|
|
|
|
doc: 'verifer version for new and changed passwords',
|
2015-05-13 03:48:26 +03:00
|
|
|
format: 'int',
|
|
|
|
env: 'VERIFIER_VERSION',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: 1
|
|
|
|
},
|
|
|
|
snsTopicArn: {
|
|
|
|
doc: 'Amazon SNS topic on which to send account event notifications. Set to "disabled" to turn off the notifier',
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'SNS_TOPIC_ARN',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
bounces: {
|
|
|
|
region: {
|
|
|
|
doc: 'The region where the queues live, most likely the same region we are sending email e.g. us-east-1, us-west-2',
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'BOUNCE_REGION',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
bounceQueueUrl: {
|
|
|
|
doc: 'The bounce queue URL to use (should include https://sqs.<region>.amazonaws.com/<account-id>/<queue-name>)',
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'BOUNCE_QUEUE_URL',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
complaintQueueUrl: {
|
|
|
|
doc: 'The complaint queue URL to use (should include https://sqs.<region>.amazonaws.com/<account-id>/<queue-name>)',
|
|
|
|
format: String,
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'COMPLAINT_QUEUE_URL',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: ''
|
|
|
|
}
|
|
|
|
},
|
2015-10-28 06:26:33 +03:00
|
|
|
verificationReminders: {
|
|
|
|
rate: {
|
|
|
|
doc: 'Rate of users getting the verification reminder. If "0" then the feature is disabled. If "1" all users get it.',
|
|
|
|
default: 0,
|
|
|
|
env: 'VERIFICATION_REMINDER_RATE'
|
|
|
|
}
|
|
|
|
},
|
2015-05-10 22:11:59 +03:00
|
|
|
useHttps: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'set to true to serve directly over https',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'USE_TLS',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: false
|
|
|
|
},
|
|
|
|
keyPath: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'path to SSL key in PEM format if serving over https',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'TLS_KEY_PATH',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: path.resolve(__dirname, '../key.pem')
|
|
|
|
},
|
|
|
|
certPath: {
|
2015-06-19 02:12:42 +03:00
|
|
|
doc: 'path to SSL certificate in PEM format if serving over https',
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'TLS_CERT_PATH',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: path.resolve(__dirname, '../cert.pem')
|
|
|
|
},
|
|
|
|
lockoutEnabled: {
|
|
|
|
doc: 'Is account lockout enabled',
|
|
|
|
format: Boolean,
|
2015-05-13 03:48:26 +03:00
|
|
|
env: 'LOCKOUT_ENABLED',
|
2015-05-10 22:11:59 +03:00
|
|
|
default: false
|
2015-07-30 01:05:29 +03:00
|
|
|
},
|
2016-04-07 04:44:23 +03:00
|
|
|
newLoginNotificationEnabled: {
|
|
|
|
doc: 'Is the new-login notification email enabled',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'NEW_LOGIN_NOTIFICATION_ENABLED',
|
|
|
|
default: true
|
|
|
|
},
|
2016-05-02 03:51:51 +03:00
|
|
|
// A safety switch to disable device metadata updates,
|
|
|
|
// in case problems with the client logic cause server overload.
|
|
|
|
deviceUpdatesEnabled: {
|
|
|
|
doc: 'Are updates to device metadata enabled?',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'DEVICE_UPDATES_ENABLED',
|
|
|
|
default: true
|
|
|
|
},
|
2016-07-20 23:53:20 +03:00
|
|
|
// A safety switch to disable device-driven notifications,
|
|
|
|
// in case problems with the client logic cause server overload.
|
|
|
|
deviceNotificationsEnabled: {
|
|
|
|
doc: 'Are device-driven notifications enabled?',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'DEVICE_NOTIFICATIONS_ENABLED',
|
|
|
|
default: true
|
|
|
|
},
|
2015-10-01 09:54:40 +03:00
|
|
|
oauth: {
|
|
|
|
url: {
|
|
|
|
format: 'url',
|
|
|
|
doc: 'URL at which to verify OAuth tokens',
|
|
|
|
default: 'http://localhost:9010',
|
|
|
|
env: 'OAUTH_URL'
|
2015-11-13 00:40:26 +03:00
|
|
|
},
|
2016-02-08 08:34:21 +03:00
|
|
|
keepAlive: {
|
|
|
|
format: Boolean,
|
|
|
|
doc: 'Use HTTP keep-alive connections when talking to oauth server',
|
|
|
|
env: 'OAUTH_KEEPALIVE',
|
|
|
|
default: false
|
|
|
|
},
|
2016-02-08 08:33:17 +03:00
|
|
|
extra: {
|
|
|
|
email: {
|
|
|
|
doc: 'Temporary extra parameter to prevent request recursion',
|
|
|
|
default: false
|
|
|
|
}
|
2015-10-01 09:54:40 +03:00
|
|
|
}
|
|
|
|
},
|
2015-08-12 22:13:42 +03:00
|
|
|
statsd: {
|
|
|
|
enabled: {
|
|
|
|
doc: 'enable UDP based statsd reporting',
|
|
|
|
default: true,
|
|
|
|
env: 'STATSD_ENABLE'
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
doc: 'StatsD host for sending logging events',
|
|
|
|
default: 'localhost',
|
|
|
|
env: 'STATSD_HOST'
|
|
|
|
},
|
|
|
|
port: {
|
|
|
|
format: 'port',
|
|
|
|
default: 8125,
|
|
|
|
env: 'STATSD_PORT'
|
|
|
|
},
|
|
|
|
sample_rate: {
|
|
|
|
doc: 'statsd sample rate',
|
|
|
|
default: 0.1,
|
|
|
|
env: 'STATSD_SAMPLE_RATE'
|
|
|
|
}
|
2015-10-12 16:38:32 +03:00
|
|
|
},
|
2016-05-13 08:08:39 +03:00
|
|
|
metrics: {
|
|
|
|
flow_id_key: {
|
|
|
|
default: 'YOU MUST CHANGE ME',
|
|
|
|
doc: 'FlowId validation key, as used by content-server',
|
2016-06-30 08:30:40 +03:00
|
|
|
format: String,
|
|
|
|
env: 'FLOW_ID_KEY'
|
2016-05-13 08:08:39 +03:00
|
|
|
},
|
|
|
|
flow_id_expiry: {
|
|
|
|
doc: 'Time after which flowIds are considered stale.',
|
|
|
|
format: 'duration',
|
2016-10-05 06:27:37 +03:00
|
|
|
default: '2 hours',
|
2016-06-30 08:30:40 +03:00
|
|
|
env: 'FLOW_ID_EXPIRY'
|
2016-05-13 08:08:39 +03:00
|
|
|
}
|
|
|
|
},
|
2015-10-12 16:38:32 +03:00
|
|
|
corsOrigin: {
|
|
|
|
doc: 'Value for the Access-Control-Allow-Origin response header',
|
2016-05-23 12:16:05 +03:00
|
|
|
format: Array,
|
2015-10-12 16:38:32 +03:00
|
|
|
env: 'CORS_ORIGIN',
|
2016-05-23 12:16:05 +03:00
|
|
|
default: ['*']
|
2016-04-06 06:41:38 +03:00
|
|
|
},
|
|
|
|
clientAddressDepth: {
|
|
|
|
doc: 'location of the client ip address in the remote address chain',
|
|
|
|
format: Number,
|
|
|
|
env: 'CLIENT_ADDRESS_DEPTH',
|
|
|
|
default: 3
|
2016-06-10 19:33:05 +03:00
|
|
|
},
|
|
|
|
signinConfirmation: {
|
|
|
|
enabled: {
|
|
|
|
doc: 'enable signin confirmation',
|
2016-09-22 19:44:34 +03:00
|
|
|
format: Boolean,
|
2016-06-10 19:33:05 +03:00
|
|
|
default: false,
|
|
|
|
env: 'SIGNIN_CONFIRMATION_ENABLED'
|
|
|
|
},
|
|
|
|
sample_rate: {
|
2016-06-30 20:38:32 +03:00
|
|
|
doc: 'signin confirmation sample rate, between 0.0 and 1.0',
|
2016-09-22 19:44:34 +03:00
|
|
|
format: Number,
|
2016-06-10 19:33:05 +03:00
|
|
|
default: 1.0,
|
|
|
|
env: 'SIGNIN_CONFIRMATION_RATE'
|
|
|
|
},
|
|
|
|
supportedClients: {
|
|
|
|
doc: 'support sign-in confirmation for only these clients',
|
|
|
|
format: Array,
|
|
|
|
default: [
|
|
|
|
'iframe',
|
|
|
|
'fx_firstrun_v1',
|
|
|
|
'fx_firstrun_v2',
|
|
|
|
'fx_desktop_v1',
|
|
|
|
'fx_desktop_v2',
|
2016-07-12 17:08:17 +03:00
|
|
|
'fx_desktop_v3',
|
|
|
|
'fx_ios_v1',
|
|
|
|
'fx_ios_v2',
|
|
|
|
'fx_fennec_v1'
|
2016-06-10 19:33:05 +03:00
|
|
|
],
|
|
|
|
env: 'SIGNIN_CONFIRMATION_SUPPORTED_CLIENTS'
|
|
|
|
},
|
2016-10-03 16:20:34 +03:00
|
|
|
enabledEmailAddresses: {
|
2016-06-16 14:40:02 +03:00
|
|
|
doc: 'If feature enabled, force sign-in confirmation for email addresses matching this regex.',
|
2016-10-03 16:20:34 +03:00
|
|
|
format: RegExp,
|
|
|
|
default: /.+@mozilla\.com$/,
|
2016-06-16 14:40:02 +03:00
|
|
|
env: 'SIGNIN_CONFIRMATION_FORCE_EMAIL_REGEX'
|
2016-06-10 19:33:05 +03:00
|
|
|
}
|
2016-09-06 20:31:33 +03:00
|
|
|
},
|
|
|
|
securityHistory: {
|
|
|
|
enabled: {
|
|
|
|
doc: 'enable security history',
|
|
|
|
default: true,
|
|
|
|
env: 'SECURITY_HISTORY_ENABLED'
|
|
|
|
}
|
2016-09-22 19:44:34 +03:00
|
|
|
},
|
|
|
|
lastAccessTimeUpdates: {
|
|
|
|
enabled: {
|
|
|
|
doc: 'enable updates to the lastAccessTime session token property',
|
|
|
|
format: Boolean,
|
|
|
|
default: false,
|
|
|
|
env: 'LASTACCESSTIME_UPDATES_ENABLED'
|
|
|
|
},
|
|
|
|
sampleRate: {
|
|
|
|
doc: 'sample rate for updates to the lastAccessTime session token property, in the range 0..1',
|
|
|
|
format: Number,
|
|
|
|
default: 1,
|
|
|
|
env: 'LASTACCESSTIME_UPDATES_SAMPLE_RATE'
|
|
|
|
},
|
|
|
|
enabledEmailAddresses: {
|
|
|
|
doc: 'regex matching enabled email addresses for updates to the lastAccessTime session token property',
|
2016-10-03 16:20:34 +03:00
|
|
|
format: RegExp,
|
|
|
|
default: /.+@mozilla\.com$/,
|
2016-09-22 19:44:34 +03:00
|
|
|
env: 'LASTACCESSTIME_UPDATES_EMAIL_ADDRESSES'
|
|
|
|
}
|
2016-10-12 03:26:37 +03:00
|
|
|
},
|
|
|
|
signinUnblock: {
|
|
|
|
codeLength: {
|
|
|
|
doc: 'Number of base36 digits to make up an unblockCode',
|
|
|
|
default: 8,
|
|
|
|
env: 'SIGNIN_UNBLOCK_CODE_LENGTH'
|
|
|
|
},
|
|
|
|
codeLifetime: {
|
|
|
|
doc: 'How long an unblockCode should be valid for',
|
|
|
|
format: 'duration',
|
|
|
|
default: '1 hour',
|
|
|
|
env: 'SIGNIN_UNBLOCK_CODE_LIFETIME'
|
|
|
|
},
|
|
|
|
enabled: {
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
allowedEmailAddresses: {
|
|
|
|
doc: 'If feature enabled, allow sign-in unblock for email addresses matching this regex.',
|
|
|
|
format: RegExp,
|
|
|
|
default: '.+@mozilla\\.com$',
|
|
|
|
env: 'SIGNIN_UNBLOCK_ALLOWED_EMAILS'
|
|
|
|
},
|
|
|
|
forcedEmailAddresses: {
|
|
|
|
doc: 'If feature enabled, force sign-in unblock for email addresses matching this regex.',
|
|
|
|
format: RegExp,
|
|
|
|
default: '^$', // default is no one
|
|
|
|
env: 'SIGNIN_UNBLOCK_FORCED_EMAILS'
|
|
|
|
},
|
|
|
|
sampleRate: {
|
|
|
|
doc: 'signin unblock sample rate, between 0.0 and 1.0',
|
|
|
|
default: 1.0,
|
|
|
|
env: 'SIGNIN_UNBLOCK_RATE'
|
|
|
|
},
|
|
|
|
supportedClients: {
|
|
|
|
doc: 'support sign-in unblock for only these clients',
|
|
|
|
format: Array,
|
|
|
|
default: [
|
|
|
|
'web',
|
|
|
|
'oauth',
|
|
|
|
'iframe',
|
|
|
|
'fx_firstrun_v1',
|
|
|
|
'fx_firstrun_v2',
|
|
|
|
'fx_desktop_v1',
|
|
|
|
'fx_desktop_v2',
|
|
|
|
'fx_desktop_v3',
|
|
|
|
'fx_ios_v1',
|
|
|
|
'fx_ios_v2',
|
|
|
|
'fx_fennec_v1'
|
|
|
|
],
|
|
|
|
env: 'SIGNIN_UNBLOCK_SUPPORTED_CLIENTS'
|
|
|
|
}
|
2016-10-14 18:34:11 +03:00
|
|
|
},
|
|
|
|
hpkpConfig: {
|
|
|
|
enabled: {
|
|
|
|
default: false,
|
|
|
|
doc: 'Feature flag for appending HPKP headers',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'HPKP_ENABLE'
|
|
|
|
},
|
|
|
|
reportOnly: {
|
|
|
|
default: true,
|
|
|
|
doc: 'Enable report only mode',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'HPKP_REPORT_ONLY'
|
|
|
|
},
|
|
|
|
reportUri: {
|
|
|
|
default: '',
|
|
|
|
doc: 'Enable report only mode',
|
|
|
|
format: String,
|
|
|
|
env: 'HPKP_REPORT_URI'
|
|
|
|
},
|
|
|
|
includeSubDomains: {
|
|
|
|
default: true,
|
|
|
|
doc: 'Include Sub-Domains',
|
|
|
|
format: Boolean,
|
|
|
|
env: 'HPKP_INCLUDE_SUBDOMAINS'
|
|
|
|
},
|
|
|
|
maxAge: {
|
|
|
|
default: 1,
|
|
|
|
doc: 'Max age for HPKP headers (seconds)',
|
|
|
|
format: Number,
|
|
|
|
env: 'HPKP_MAX_AGE'
|
|
|
|
},
|
|
|
|
sha256s: {
|
|
|
|
default: [],
|
|
|
|
doc: 'Supported pin-sha256s',
|
|
|
|
format: Array,
|
|
|
|
env: 'HPKP_PIN_SHA256'
|
|
|
|
}
|
2015-05-10 22:11:59 +03:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// handle configuration files. you can specify a CSV list of configuration
|
|
|
|
// files to process, which will be overlayed in order, in the CONFIG_FILES
|
2015-05-13 03:48:26 +03:00
|
|
|
// environment variable.
|
2015-05-10 22:11:59 +03:00
|
|
|
|
2015-05-13 03:48:26 +03:00
|
|
|
var files = (process.env.CONFIG_FILES || '').split(',').filter(fs.existsSync)
|
2015-05-10 22:11:59 +03:00
|
|
|
conf.loadFile(files)
|
2015-08-28 00:07:00 +03:00
|
|
|
conf.validate({ strict: true })
|
2015-05-10 22:11:59 +03:00
|
|
|
|
|
|
|
// set the public url as the issuer domain for assertions
|
|
|
|
conf.set('domain', url.parse(conf.get('publicUrl')).host)
|
|
|
|
|
|
|
|
// derive fxa-auth-mailer configuration from our content-server url
|
|
|
|
conf.set('smtp.verificationUrl', conf.get('contentServer.url') + '/v1/verify_email')
|
|
|
|
conf.set('smtp.passwordResetUrl', conf.get('contentServer.url') + '/v1/complete_reset_password')
|
2015-08-28 00:07:00 +03:00
|
|
|
conf.set('smtp.initiatePasswordResetUrl', conf.get('contentServer.url') + '/reset_password')
|
|
|
|
conf.set('smtp.initiatePasswordChangeUrl', conf.get('contentServer.url') + '/settings/change_password')
|
2016-04-14 08:30:11 +03:00
|
|
|
conf.set('smtp.verifyLoginUrl', conf.get('contentServer.url') + '/complete_signin')
|
2016-10-12 03:26:37 +03:00
|
|
|
conf.set('smtp.reportSignInUrl', conf.get('contentServer.url') + '/report_signin')
|
2015-05-10 22:11:59 +03:00
|
|
|
|
2015-07-30 01:05:29 +03:00
|
|
|
conf.set('isProduction', conf.get('env') === 'prod')
|
|
|
|
|
2015-05-10 22:11:59 +03:00
|
|
|
module.exports = conf
|