@kustodian/plugin-doppler 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kustodian/plugin-doppler",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Doppler secret provider plugin for Kustodian",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -37,9 +37,9 @@
37
37
  "registry": "https://npm.pkg.github.com"
38
38
  },
39
39
  "dependencies": {
40
- "@kustodian/core": "workspace:*",
41
- "@kustodian/plugins": "workspace:*",
42
- "@kustodian/schema": "workspace:*"
40
+ "@kustodian/core": "1.1.0",
41
+ "@kustodian/plugins": "1.0.1",
42
+ "@kustodian/schema": "1.3.0"
43
43
  },
44
44
  "devDependencies": {}
45
45
  }
package/src/resolver.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  /**
13
13
  * Resolves Doppler substitutions to actual secret values.
14
14
  * Groups by project/config to minimize API calls.
15
+ * Uses cluster-level defaults when project/config are not specified.
15
16
  * Returns a map from substitution name to resolved value.
16
17
  */
17
18
  export async function resolve_doppler_substitutions(
@@ -22,10 +23,31 @@ export async function resolve_doppler_substitutions(
22
23
  return success({});
23
24
  }
24
25
 
25
- // Group substitutions by project/config to minimize API calls
26
- const groups = new Map<DopplerCacheKeyType, DopplerSubstitutionType[]>();
26
+ // Validate and apply cluster defaults
27
+ const resolved_subs: Array<DopplerSubstitutionType & { project: string; config: string }> = [];
27
28
 
28
29
  for (const sub of substitutions) {
30
+ const project = sub.project ?? options.cluster_defaults?.project;
31
+ const config = sub.config ?? options.cluster_defaults?.config;
32
+
33
+ if (!project || !config) {
34
+ return failure({
35
+ code: 'MISSING_DOPPLER_CONFIG',
36
+ message: `Doppler substitution '${sub.name}' missing project/config and no cluster defaults configured`,
37
+ });
38
+ }
39
+
40
+ resolved_subs.push({
41
+ ...sub,
42
+ project,
43
+ config,
44
+ });
45
+ }
46
+
47
+ // Group substitutions by project/config to minimize API calls
48
+ const groups = new Map<DopplerCacheKeyType, typeof resolved_subs>();
49
+
50
+ for (const sub of resolved_subs) {
29
51
  const key = create_cache_key(sub.project, sub.config);
30
52
  const group = groups.get(key) ?? [];
31
53
  group.push(sub);
@@ -40,7 +62,10 @@ export async function resolve_doppler_substitutions(
40
62
  // Fetch secrets for each group
41
63
  for (const [key, subs] of groups) {
42
64
  // Get project and config from the first substitution in the group
43
- const first = subs[0]!;
65
+ const first = subs[0];
66
+ if (!first) {
67
+ continue;
68
+ }
44
69
 
45
70
  // Check if we already have the secrets cached
46
71
  let secrets = secrets_cache.get(key);
package/src/types.ts CHANGED
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Cluster-level Doppler defaults.
3
+ */
4
+ export interface DopplerClusterDefaultsType {
5
+ /** Default project name */
6
+ project?: string | undefined;
7
+ /** Default config name */
8
+ config?: string | undefined;
9
+ }
10
+
1
11
  /**
2
12
  * Options for the Doppler plugin.
3
13
  */
@@ -8,6 +18,8 @@ export interface DopplerPluginOptionsType {
8
18
  timeout?: number | undefined;
9
19
  /** Whether to fail on missing secrets (default: true) */
10
20
  fail_on_missing?: boolean | undefined;
21
+ /** Cluster-level defaults for project/config */
22
+ cluster_defaults?: DopplerClusterDefaultsType | undefined;
11
23
  }
12
24
 
13
25
  /**