mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
Remove no longer used settings and checks
Change-type: patch
This commit is contained in:
parent
9bf58c89d4
commit
745a2f1886
@ -18,7 +18,6 @@ import * as _debug from 'debug';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import * as packageJSON from '../../../../package.json';
|
import * as packageJSON from '../../../../package.json';
|
||||||
import * as errors from '../../../shared/errors';
|
|
||||||
import * as localSettings from './local-settings';
|
import * as localSettings from './local-settings';
|
||||||
|
|
||||||
const debug = _debug('etcher:models:settings');
|
const debug = _debug('etcher:models:settings');
|
||||||
@ -32,8 +31,6 @@ export const DEFAULT_SETTINGS: _.Dictionary<any> = {
|
|||||||
updatesEnabled:
|
updatesEnabled:
|
||||||
packageJSON.updates.enabled &&
|
packageJSON.updates.enabled &&
|
||||||
!_.includes(['rpm', 'deb'], packageJSON.packageType),
|
!_.includes(['rpm', 'deb'], packageJSON.packageType),
|
||||||
lastSleptUpdateNotifier: null,
|
|
||||||
lastSleptUpdateNotifierVersion: null,
|
|
||||||
desktopNotifications: true,
|
desktopNotifications: true,
|
||||||
autoBlockmapping: true,
|
autoBlockmapping: true,
|
||||||
decompressFirst: true,
|
decompressFirst: true,
|
||||||
@ -46,7 +43,6 @@ let settings = _.cloneDeep(DEFAULT_SETTINGS);
|
|||||||
*/
|
*/
|
||||||
export async function reset(): Promise<void> {
|
export async function reset(): Promise<void> {
|
||||||
debug('reset');
|
debug('reset');
|
||||||
// TODO: Remove default settings from config file (?)
|
|
||||||
settings = _.cloneDeep(DEFAULT_SETTINGS);
|
settings = _.cloneDeep(DEFAULT_SETTINGS);
|
||||||
return await localSettings.writeAll(settings);
|
return await localSettings.writeAll(settings);
|
||||||
}
|
}
|
||||||
@ -65,18 +61,6 @@ export async function load(): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
export async function set(key: string, value: any): Promise<void> {
|
export async function set(key: string, value: any): Promise<void> {
|
||||||
debug('set', key, value);
|
debug('set', key, value);
|
||||||
if (_.isNil(key)) {
|
|
||||||
throw errors.createError({
|
|
||||||
title: 'Missing setting key',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_.isString(key)) {
|
|
||||||
throw errors.createError({
|
|
||||||
title: `Invalid setting key: ${key}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const previousValue = settings[key];
|
const previousValue = settings[key];
|
||||||
settings[key] = value;
|
settings[key] = value;
|
||||||
try {
|
try {
|
||||||
@ -92,7 +76,7 @@ export async function set(key: string, value: any): Promise<void> {
|
|||||||
* @summary Get a setting value
|
* @summary Get a setting value
|
||||||
*/
|
*/
|
||||||
export function get(key: string): any {
|
export function get(key: string): any {
|
||||||
return _.cloneDeep(_.get(settings, [key]));
|
return _.cloneDeep(settings[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user