forked from renovatebot/renovate
/
admin.ts
30 lines (26 loc) · 844 Bytes
/
admin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import type { RenovateConfig, RepoAdminConfig } from './types';
let adminConfig: RepoAdminConfig = {};
// TODO: once admin config work is complete, add a test to make sure this list includes all options with admin=true (#9603)
export const repoAdminOptions = [
'allowCustomCrateRegistries',
'allowPostUpgradeCommandTemplating',
'allowScripts',
'allowedPostUpgradeCommands',
'customEnvVariables',
'dockerChildPrefix',
'dockerImagePrefix',
'dockerUser',
'dryRun',
'exposeAllEnv',
'privateKey',
];
export function setAdminConfig(config: RenovateConfig = {}): void {
adminConfig = {};
for (const option of repoAdminOptions) {
adminConfig[option] = config[option];
delete config[option]; // eslint-disable-line no-param-reassign
}
}
export function getAdminConfig(): RepoAdminConfig {
return adminConfig;
}