Basically i already have an existing configuration file in my React application for different customers. The issue is, i have too many configurations for different customers. Below is my configuration file.
if (process.env.API_ENV && process.env.API_ENV === 'development') {
appConfig = {
localhost: {
secret: 'sfsd',
app_key: 'hfghfgh',
defaultUser: 'dashboard',
defaultPassword: '4444',
shipToMeTab: true,
searchBar: false,
tab1: false,
...,
...,
...,
},
'customer1.com': {
secret: 'sfsd',
app_key: 'hfghfgh',
defaultUser: 'dashboard',
defaultPassword: '4444',
tab1: false,
...,
...,
...,
},
'customer2.com': {
secret: 'sfsd',
app_key: 'hfghfgh',
defaultUser: 'dashboard',
defaultPassword: '4444',
tab0: true,
tab1: false,
...,
...,
...,
},
'customer3.com': {
secret: 'sfsd',
app_key: 'hfghfgh',
defaultUser: 'dashboard',
defaultPassword: '4444',
tab0: false,
tab1: false,
...,
...,
...,
}
}
}
So the configurations for each customer has more parameters and they are different. Currently its maintained in config.js file like above.
My question is, Is this the proper way in React to define the configurations for different customers? Are there any other way so that i can define those parameters in a separate file and in terms of optimization as well?