feat: aggregated environment variable stream
This commit is contained in:
parent
e38af0bebe
commit
c23a4bf75d
1 changed files with 23 additions and 0 deletions
|
|
@ -259,6 +259,29 @@ export const currentEnvironment$ = combineLatest([
|
|||
})
|
||||
)
|
||||
|
||||
/**
|
||||
* Stream returning all the environment variables accessible in
|
||||
* the current state (Global + The Selected Environment).
|
||||
* NOTE: The source environment attribute will be "global" for Global Env as source.
|
||||
*/
|
||||
export const aggregateEnvs$ = combineLatest([
|
||||
currentEnvironment$,
|
||||
globalEnv$,
|
||||
]).pipe(
|
||||
map(([selectedEnv, globalVars]) => {
|
||||
const results: { key: string; value: string; sourceEnv: string }[] = []
|
||||
|
||||
selectedEnv.variables.forEach(({ key, value }) =>
|
||||
results.push({ key, value, sourceEnv: selectedEnv.name })
|
||||
)
|
||||
globalVars.forEach(({ key, value }) =>
|
||||
results.push({ key, value, sourceEnv: "global" })
|
||||
)
|
||||
|
||||
return results
|
||||
})
|
||||
)
|
||||
|
||||
export function getCurrentEnvironment(): Environment {
|
||||
if (environmentsStore.value.currentEnvironmentIndex === -1) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue