Cleanup some unnecessary utility (#1453)

This commit is contained in:
Andrea Giammarchi
2023-05-06 08:20:08 +02:00
committed by GitHub
parent 213ced0c7f
commit 6a27c6d9f2
5 changed files with 8 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
import toml from '@hoodmane/toml-j0.4';
import { getLogger } from './logger';
import { version } from './version';
import { getAttribute, readTextFromPath, htmlDecode, createDeprecationWarning } from './utils';
import { readTextFromPath, htmlDecode, createDeprecationWarning } from './utils';
import { UserError, ErrorCode } from './exceptions';
const logger = getLogger('py-config');
@@ -74,7 +74,7 @@ export function loadConfigFromElement(el: Element): AppConfig {
srcConfig = {};
inlineConfig = {};
} else {
const configType = getAttribute(el, 'type') || 'toml';
const configType = el.getAttribute('type') || 'toml';
srcConfig = extractFromSrc(el, configType);
inlineConfig = extractFromInline(el, configType);
}
@@ -88,7 +88,7 @@ export function loadConfigFromElement(el: Element): AppConfig {
}
function extractFromSrc(el: Element, configType: string) {
const src = getAttribute(el, 'src');
const src = el.getAttribute('src');
if (src) {
logger.info('loading ', src);
return validateConfig(readTextFromPath(src), configType);