mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 18:56:24 +00:00
Switch to local mode in unmanaged mode
Change-type: major Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
91a6340563
commit
5bb3820d6a
@ -149,5 +149,12 @@ export function createProviderFunctions(
|
||||
]);
|
||||
},
|
||||
},
|
||||
unmanaged: {
|
||||
get: () => {
|
||||
return config.get('apiEndpoint').then(apiEndpoint => {
|
||||
return !apiEndpoint;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class Config extends EventEmitter {
|
||||
mixpanelHost: { source: 'func' },
|
||||
extendedEnvOptions: { source: 'func' },
|
||||
fetchOptions: { source: 'func' },
|
||||
unmanaged: { source: 'func' },
|
||||
|
||||
// NOTE: all 'db' values are stored and loaded as *strings*,
|
||||
apiSecret: { source: 'db', mutable: true },
|
||||
|
@ -40,9 +40,20 @@ export class LocalModeManager {
|
||||
}
|
||||
});
|
||||
|
||||
const localMode = checkTruthy(
|
||||
(await this.config.get('localMode')) || false,
|
||||
);
|
||||
// On startup, check if we're in unmanaged mode,
|
||||
// as local mode needs to be set
|
||||
let unmanagedLocalMode = false;
|
||||
if (checkTruthy((await this.config.get('unmanaged')) || false)) {
|
||||
console.log('Starting up in unmanaged mode, activating local mode');
|
||||
await this.config.set({ localMode: true });
|
||||
unmanagedLocalMode = true;
|
||||
}
|
||||
|
||||
const localMode =
|
||||
// short circuit the next get if we know we're in local mode
|
||||
unmanagedLocalMode ||
|
||||
checkTruthy((await this.config.get('localMode')) || false);
|
||||
|
||||
if (!localMode) {
|
||||
// Remove any leftovers if necessary
|
||||
await this.removeLocalModeArtifacts();
|
||||
|
Loading…
Reference in New Issue
Block a user