CEC-4044 update manifest form (#312)
* CEC-4044 update manifest form * Show env input if there are options
This commit is contained in:
35
src/utils/key-envs.js
Normal file
35
src/utils/key-envs.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const KEY_ENVS = process.env.REACT_APP_ECCKEY_ENV;
|
||||
const ENV = process.env.REACT_APP_ENV;
|
||||
|
||||
export const CURRENT_ENV = "current";
|
||||
|
||||
const GetEnvName = (value) => {
|
||||
if (value === "cec-prd" || value === "cec-euprd") return "prd";
|
||||
return value;
|
||||
}
|
||||
|
||||
const MakeList = () => {
|
||||
const result = [];
|
||||
const list = KEY_ENVS.split(",");
|
||||
|
||||
list.forEach((env) => {
|
||||
if (env.length > 0) result.push({
|
||||
value: env,
|
||||
label: env,
|
||||
})
|
||||
})
|
||||
result.unshift({
|
||||
value: CURRENT_ENV,
|
||||
label: GetEnvName(ENV),
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export const GetEnvValue = (value) => {
|
||||
if (value === ENV) return CURRENT_ENV;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
export const ENVS = MakeList();
|
||||
Reference in New Issue
Block a user