Created configuration files by NODE_ENV
This commit is contained in:
parent
0212bcb162
commit
b26ad98237
|
@ -0,0 +1,8 @@
|
|||
// @flow
|
||||
import { TX_SERVICE_HOST } from '~/config/names'
|
||||
|
||||
const devConfig = {
|
||||
[TX_SERVICE_HOST]: 'https://safe-transaction-history.dev.gnosisdev.com/api/v1/',
|
||||
}
|
||||
|
||||
export default devConfig
|
|
@ -0,0 +1,28 @@
|
|||
// @flow
|
||||
import { ensureOnce } from '~/utils/singleton'
|
||||
import { TX_SERVICE_HOST } from '~/config/names'
|
||||
import devConfig from './development'
|
||||
import testConfig from './testing'
|
||||
import prodConfig from './production'
|
||||
|
||||
const configuration = () => {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
return testConfig
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return prodConfig
|
||||
}
|
||||
|
||||
return devConfig
|
||||
}
|
||||
|
||||
const getConfig = ensureOnce(configuration)
|
||||
|
||||
export const getTxServiceHost = () => {
|
||||
const config = getConfig()
|
||||
|
||||
return config[TX_SERVICE_HOST]
|
||||
}
|
||||
|
||||
export const getTxServiceUriFrom = (safeAddress: string) => `safes/${safeAddress}/transactions/`
|
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export const TX_SERVICE_HOST = 'tsh'
|
|
@ -0,0 +1,8 @@
|
|||
// @flow
|
||||
import { TX_SERVICE_HOST } from '~/config/names'
|
||||
|
||||
const prodConfig = {
|
||||
[TX_SERVICE_HOST]: 'https://safe-transaction-history.dev.gnosisdev.com/api/v1/',
|
||||
}
|
||||
|
||||
export default prodConfig
|
|
@ -0,0 +1,8 @@
|
|||
// @flow
|
||||
import { TX_SERVICE_HOST } from '~/config/names'
|
||||
|
||||
const testConfig = {
|
||||
[TX_SERVICE_HOST]: 'http://localhost:8080/api/v1/',
|
||||
}
|
||||
|
||||
export default testConfig
|
Loading…
Reference in New Issue