feat(policy): add --admin-policy flag for supplemental admin policies (#20360)

This commit is contained in:
Gal Zahavi
2026-03-11 10:35:45 -07:00
committed by GitHub
parent 7e9e196793
commit 6900fe5527
12 changed files with 516 additions and 810 deletions
+27 -13
View File
@@ -134,6 +134,18 @@ export interface SettingsSchema {
export type MemoryImportFormat = 'tree' | 'flat';
export type DnsResolutionOrder = 'ipv4first' | 'verbatim';
const pathArraySetting = (label: string, description: string) => ({
type: 'array' as const,
label,
category: 'Advanced' as const,
requiresRestart: true as const,
default: [] as string[],
description,
showInDialog: false as const,
items: { type: 'string' as const },
mergeStrategy: MergeStrategy.UNION,
});
/**
* The canonical schema for all settings.
* The structure of this object defines the structure of the `Settings` type.
@@ -156,17 +168,15 @@ const SETTINGS_SCHEMA = {
},
},
policyPaths: {
type: 'array',
label: 'Policy Paths',
category: 'Advanced',
requiresRestart: true,
default: [] as string[],
description: 'Additional policy files or directories to load.',
showInDialog: false,
items: { type: 'string' },
mergeStrategy: MergeStrategy.UNION,
},
policyPaths: pathArraySetting(
'Policy Paths',
'Additional policy files or directories to load.',
),
adminPolicyPaths: pathArraySetting(
'Admin Policy Paths',
'Additional admin policy files or directories to load.',
),
general: {
type: 'object',
@@ -2677,7 +2687,9 @@ type InferSettings<T extends SettingsSchema> = {
? boolean
: T[K]['default'] extends string
? string
: T[K]['default'];
: T[K]['default'] extends ReadonlyArray<infer U>
? U[]
: T[K]['default'];
};
type InferMergedSettings<T extends SettingsSchema> = {
@@ -2691,7 +2703,9 @@ type InferMergedSettings<T extends SettingsSchema> = {
? boolean
: T[K]['default'] extends string
? string
: T[K]['default'];
: T[K]['default'] extends ReadonlyArray<infer U>
? U[]
: T[K]['default'];
};
export type Settings = InferSettings<SettingsSchemaType>;