mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-24 13:05:51 +00:00
refactor: Small code changes
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
6a3148ff80
commit
9a98fc4c84
@ -23,7 +23,7 @@ export const fnSchema = {
|
||||
return config
|
||||
.getMany(['uuid', 'apiEndpoint', 'registered_at', 'deviceId'])
|
||||
.then(requiredValues => {
|
||||
return _.every(_.values(requiredValues), Boolean);
|
||||
return _.every(_.values(requiredValues));
|
||||
});
|
||||
},
|
||||
osVersion: () => {
|
||||
|
@ -78,7 +78,7 @@ export class Config extends EventEmitter {
|
||||
});
|
||||
} else if (FnSchema.fnSchema.hasOwnProperty(key)) {
|
||||
const fnKey = key as FnSchema.FnSchemaKey;
|
||||
// Cast the promise as something that produes an unknown, and this means that
|
||||
// Cast the promise as something that produces an unknown, and this means that
|
||||
// we can validate the output of the function as well, ensuring that the type matches
|
||||
const promiseValue = FnSchema.fnSchema[fnKey](this) as Bluebird<
|
||||
unknown
|
||||
@ -220,15 +220,12 @@ export class Config extends EventEmitter {
|
||||
value = await this.configJsonBackend.get(key);
|
||||
break;
|
||||
case 'db':
|
||||
value = await db('config')
|
||||
const [conf] = await db('config')
|
||||
.select('value')
|
||||
.where({ key })
|
||||
.then(([conf]: [{ value: string }]) => {
|
||||
if (conf != null) {
|
||||
return conf.value;
|
||||
}
|
||||
return;
|
||||
});
|
||||
.where({ key });
|
||||
if (conf != null) {
|
||||
return conf.value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ export const schemaTypes = {
|
||||
},
|
||||
deltaEndpoint: {
|
||||
type: t.string,
|
||||
default: 'https://delta.resin.io',
|
||||
default: 'https://delta.balena-cloud.com',
|
||||
},
|
||||
uuid: {
|
||||
type: t.string,
|
||||
|
Loading…
x
Reference in New Issue
Block a user