Created
December 13, 2018 16:45
-
-
Save md-hamed/9212a32b37e72b1f8fd51136b1e1dfdc to your computer and use it in GitHub Desktop.
Simple configurations to be used with Ionic
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
import * as deepExtend from 'deep-extend'; | |
/** | |
* Add default configurations here | |
*/ | |
const DEFAULT_CONFIG = { | |
config1: 'foo', | |
config2: { | |
nestedConfig1: 'dev' | |
} | |
// other configs .. | |
}; | |
/** | |
* Add development configurations here | |
*/ | |
const DEV_CONGIF = { | |
}; | |
/** | |
* Add production configurations here | |
*/ | |
const PROD_CONFIG = { | |
config2: { | |
nestedConfig1: 'prod' | |
} | |
}; | |
// merge both default, development, and production configurations | |
var _CONFIG; | |
if (process.env.IONIC_ENV == 'dev') { | |
_CONFIG = deepExtend(DEFAULT_CONFIG, DEV_CONGIF); | |
} else if (process.env.IONIC_ENV == 'prod') { | |
_CONFIG = deepExtend(DEFAULT_CONFIG, PROD_CONFIG); | |
} | |
export const CONFIG = _CONFIG; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you use this config in for instance app.module.ts?