diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js
index 5e1398b2c..de521cf78 100644
--- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js
+++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js
@@ -11,6 +11,7 @@ import { useFormik } from 'formik';
import * as Yup from 'yup';
import { uuid } from 'utils/common';
import { variableNameRegex } from 'utils/common/regex';
+import { maskInputValue } from 'utils/collections';
const EnvironmentVariables = ({ environment, collection }) => {
const dispatch = useDispatch();
@@ -120,13 +121,17 @@ const EnvironmentVariables = ({ environment, collection }) => {
- formik.setFieldValue(`${index}.value`, newValue, true)}
- />
+ {variable.secret ? (
+ {maskInputValue(variable.value)}
+ ) : (
+ formik.setFieldValue(`${index}.value`, newValue, true)}
+ />
+ )}
|
{
data = data || {};
+ const [showSecret, setShowSecret] = useState(false);
return (
+ setShowSecret(!showSecret)} />
- {Object.entries(data).map(([key, value]) => (
-
- {key} |
+ {data.map((envVar) => (
+
+ {envVar.name} |
-
+
|
))}
@@ -41,10 +47,6 @@ const EnvVariables = ({ collection, theme }) => {
const envVars = get(environment, 'variables', []);
const enabledEnvVars = filter(envVars, (variable) => variable.enabled);
- const envVarsObj = enabledEnvVars.reduce((acc, curr) => {
- acc[curr.name] = curr.value;
- return acc;
- }, {});
return (
<>
@@ -53,7 +55,7 @@ const EnvVariables = ({ collection, theme }) => {
({environment.name})
{enabledEnvVars.length > 0 ? (
-
+
) : (
No environment variables found
)}
@@ -96,3 +98,12 @@ const VariablesEditor = ({ collection }) => {
};
export default VariablesEditor;
+
+const SecretToggle = ({ showSecret, onClick }) => (
+
+
+ {showSecret ? : }
+ {showSecret ? 'Hide secret variable values' : 'Show secret variable values'}
+
+
+);
diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js
index a5b109e15..0ebeb69fc 100644
--- a/packages/bruno-app/src/utils/collections/index.js
+++ b/packages/bruno-app/src/utils/collections/index.js
@@ -639,3 +639,9 @@ export const getAllVariables = (collection) => {
}
};
};
+
+export const maskInputValue = (value) =>
+ value
+ .split('')
+ .map(() => '*')
+ .join('');
|