Merge branch 'master' into age-withdraw
This commit is contained in:
commit
fe7b4c8c0c
@ -136,13 +136,13 @@ function checkBasicConf(context: LintContext): BasicConf {
|
||||
const currencyEntry = cfg.getString("taler", "currency");
|
||||
let mainCurrency: string | undefined;
|
||||
|
||||
if (!currencyEntry.value) {
|
||||
if (!currencyEntry.isDefined()) {
|
||||
context.numErr++;
|
||||
console.log("error: currency not defined in section TALER option CURRENCY");
|
||||
console.log("Aborting further checks.");
|
||||
process.exit(1);
|
||||
} else {
|
||||
mainCurrency = currencyEntry.value.toUpperCase();
|
||||
mainCurrency = currencyEntry.required().toUpperCase();
|
||||
}
|
||||
|
||||
if (mainCurrency === "KUDOS") {
|
||||
|
@ -25,11 +25,14 @@
|
||||
*/
|
||||
import { AmountJson } from "./amounts.js";
|
||||
import { Amounts } from "./amounts.js";
|
||||
import { Logger } from "./logging.js";
|
||||
|
||||
import nodejs_path from "path";
|
||||
import nodejs_os from "os";
|
||||
import nodejs_fs from "fs";
|
||||
|
||||
const logger = new Logger("talerconfig.ts");
|
||||
|
||||
export class ConfigError extends Error {
|
||||
constructor(message: string) {
|
||||
super();
|
||||
@ -77,7 +80,7 @@ export class ConfigValue<T> {
|
||||
constructor(
|
||||
private sectionName: string,
|
||||
private optionName: string,
|
||||
public value: string | undefined,
|
||||
private value: string | undefined,
|
||||
private converter: (x: string) => T,
|
||||
) {}
|
||||
|
||||
@ -138,7 +141,7 @@ export function pathsub(
|
||||
lookup: (s: string, depth: number) => string | undefined,
|
||||
depth = 0,
|
||||
): string {
|
||||
if (depth >= 10) {
|
||||
if (depth >= 128) {
|
||||
throw Error("recursion in path substitution");
|
||||
}
|
||||
let s = x;
|
||||
@ -624,15 +627,18 @@ export class Configuration {
|
||||
lookupVariable(x: string, depth: number = 0): string | undefined {
|
||||
// We loop up options in PATHS in upper case, as option names
|
||||
// are case insensitive
|
||||
let val = this.findEntry("PATHS", x)?.value;
|
||||
const val = this.findEntry("PATHS", x)?.value;
|
||||
if (val !== undefined) {
|
||||
return pathsub(val, (v, d) => this.lookupVariable(v, d), depth);
|
||||
}
|
||||
|
||||
// Environment variables can be case sensitive, respect that.
|
||||
const envVal = process.env[x];
|
||||
if (envVal !== undefined) {
|
||||
return envVal;
|
||||
}
|
||||
|
||||
logger.warn(`unable to resolve variable '${x}'`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -692,12 +698,28 @@ export class Configuration {
|
||||
"DOCDIR",
|
||||
`${installPrefix}/share/doc/taler/`,
|
||||
);
|
||||
this.setStringSystemDefault("PATHS", "ICONDIR", `${installPrefix}/share/icons/`);
|
||||
this.setStringSystemDefault("PATHS", "LOCALEDIR", `${installPrefix}/share/locale/`);
|
||||
this.setStringSystemDefault(
|
||||
"PATHS",
|
||||
"ICONDIR",
|
||||
`${installPrefix}/share/icons/`,
|
||||
);
|
||||
this.setStringSystemDefault(
|
||||
"PATHS",
|
||||
"LOCALEDIR",
|
||||
`${installPrefix}/share/locale/`,
|
||||
);
|
||||
this.setStringSystemDefault("PATHS", "PREFIX", `${installPrefix}/`);
|
||||
this.setStringSystemDefault("PATHS", "BINDIR", `${installPrefix}/bin`);
|
||||
this.setStringSystemDefault("PATHS", "LIBDIR", `${installPrefix}/lib/taler/`);
|
||||
this.setStringSystemDefault("PATHS", "DATADIR", `${installPrefix}/share/taler/`);
|
||||
this.setStringSystemDefault(
|
||||
"PATHS",
|
||||
"LIBDIR",
|
||||
`${installPrefix}/lib/taler/`,
|
||||
);
|
||||
this.setStringSystemDefault(
|
||||
"PATHS",
|
||||
"DATADIR",
|
||||
`${installPrefix}/share/taler/`,
|
||||
);
|
||||
|
||||
this.loadDefaultsFromDir(baseConfigDir);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user