mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-26 16:30:34 +00:00
Created configuration files by NODE_ENV
This commit is contained in:
parent
0212bcb162
commit
b26ad98237
8
src/config/development.js
Normal file
8
src/config/development.js
Normal file
@ -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
|
28
src/config/index.js
Normal file
28
src/config/index.js
Normal file
@ -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/`
|
3
src/config/names.js
Normal file
3
src/config/names.js
Normal file
@ -0,0 +1,3 @@
|
||||
// @flow
|
||||
|
||||
export const TX_SERVICE_HOST = 'tsh'
|
8
src/config/production.js
Normal file
8
src/config/production.js
Normal file
@ -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
|
8
src/config/testing.js
Normal file
8
src/config/testing.js
Normal file
@ -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…
x
Reference in New Issue
Block a user