aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/background.js2
-rw-r--r--app/scripts/first-time-state.js7
-rw-r--r--app/scripts/lib/migrator/index.js4
3 files changed, 8 insertions, 5 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 63c8a7252..1dbfb1b98 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -31,7 +31,7 @@ const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY })
// initialization flow
initialize().catch(console.error)
-async function initialize() {
+async function initialize () {
const initState = await loadStateFromPersistence()
await setupController(initState)
console.log('MetaMask initialization complete.')
diff --git a/app/scripts/first-time-state.js b/app/scripts/first-time-state.js
index dc7788311..5e8577100 100644
--- a/app/scripts/first-time-state.js
+++ b/app/scripts/first-time-state.js
@@ -1,12 +1,15 @@
+// test and development environment variables
+const env = process.env.METAMASK_ENV
+const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
+
//
// The default state of MetaMask
//
-
module.exports = {
config: {},
NetworkController: {
provider: {
- type: 'rinkeby',
+ type: (METAMASK_DEBUG || env === 'test') ? 'rinkeby' : 'mainnet',
},
},
}
diff --git a/app/scripts/lib/migrator/index.js b/app/scripts/lib/migrator/index.js
index de6f5d5cd..4fd2cae92 100644
--- a/app/scripts/lib/migrator/index.js
+++ b/app/scripts/lib/migrator/index.js
@@ -14,8 +14,8 @@ class Migrator {
async migrateData (versionedData = this.generateInitialState()) {
const pendingMigrations = this.migrations.filter(migrationIsPending)
- for (let index in pendingMigrations) {
- let migration = pendingMigrations[index]
+ for (const index in pendingMigrations) {
+ const migration = pendingMigrations[index]
versionedData = await migration.migrate(versionedData)
if (!versionedData.data) throw new Error('Migrator - migration returned empty data')
if (versionedData.version !== undefined && versionedData.meta.version !== migration.version) throw new Error('Migrator - Migration did not update version number correctly')