import type { RenovateConfig , RepoGlobalConfig } from './types' ; export class GlobalConfig { private static readonly OPTIONS : ( keyof RepoGlobalConfig ) [ ] = [ 'allowCustomCrateRegistries' , 'allowedPostUpgradeCommands' , 'allowPlugins' , 'allowPostUpgradeCommandTemplating' , 'allowScripts' , 'binarySource' , 'cacheDir' , 'customEnvVariables' , 'dockerChildPrefix' , 'dockerImagePrefix' , 'dockerUser' , 'dryRun' , 'exposeAllEnv' , 'executionTimeout' , 'localDir' , 'migratePresets' , 'privateKey' , 'privateKeyOld' , ] ; private static config : RepoGlobalConfig = { } ; static get ( ) ; static get < Key extends keyof RepoGlobalConfig > ( key ? ) ; static get < Key extends keyof RepoGlobalConfig > ( key ? ) { return key ? GlobalConfig . config [ key ] : GlobalConfig . config ; } static set ( config ) { GlobalConfig . reset ( ) ; const result = { ... config } ; for ( const option of GlobalConfig . OPTIONS ) { GlobalConfig . config [ option ] = config [ option ] as never ; delete result [ option ] ; } return result ; } static reset ( ) { GlobalConfig . config = { } ; } }