2022-09-21 19:54:50 +00:00
|
|
|
/*!
|
|
|
|
* config.js - configuration parsing for bcoin
|
|
|
|
* Copyright (c) 2016-2017, Christopher Jeffrey (MIT License).
|
|
|
|
* https://github.com/bcoin-org/bcoin
|
|
|
|
*/
|
|
|
|
/// <reference types="node" />
|
2022-12-19 16:30:08 +00:00
|
|
|
import arg from "arg";
|
2022-09-21 19:54:50 +00:00
|
|
|
/**
|
|
|
|
* Config Parser
|
|
|
|
*/
|
|
|
|
export default class Config {
|
2022-12-06 21:39:23 +00:00
|
|
|
private module;
|
|
|
|
private data;
|
2022-12-19 16:30:08 +00:00
|
|
|
constructor(module: string);
|
2022-12-06 21:39:23 +00:00
|
|
|
inject(options: object): void;
|
2022-12-19 16:30:08 +00:00
|
|
|
load(): void;
|
2022-12-06 21:39:23 +00:00
|
|
|
openDir(dir: string): void;
|
2022-12-19 16:30:08 +00:00
|
|
|
open(file: string): void;
|
|
|
|
save(file: string, data: object): void;
|
2022-12-06 21:39:23 +00:00
|
|
|
set(key: string, value: any): void;
|
2022-12-19 16:30:08 +00:00
|
|
|
has(key: string): any;
|
|
|
|
private normalize;
|
2022-12-06 21:39:23 +00:00
|
|
|
get(key: string, fallback?: any): any;
|
|
|
|
typeOf(key: string): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null";
|
|
|
|
str(key: string, fallback?: any): any;
|
|
|
|
int(key: any, fallback?: any): any;
|
|
|
|
uint(key: any, fallback?: any): any;
|
|
|
|
float(key: any, fallback?: any): any;
|
|
|
|
ufloat(key: any, fallback?: any): any;
|
|
|
|
fixed(key: any, exp: any, fallback?: any): any;
|
|
|
|
ufixed(key: any, exp: any, fallback?: any): any;
|
|
|
|
bool(key: any, fallback?: any): any;
|
|
|
|
buf(key: string, fallback?: any, enc?: BufferEncoding): any;
|
|
|
|
array(key: string, fallback?: any): any;
|
|
|
|
obj(key: string, fallback?: any): any;
|
|
|
|
func(key: string, fallback?: any): any;
|
|
|
|
mb(key: string, fallback?: any): any;
|
2022-12-19 16:30:08 +00:00
|
|
|
parseArg(args: arg.Result<any>): void;
|
2022-12-06 21:39:23 +00:00
|
|
|
parseEnv(env?: object): void;
|
2022-09-21 19:54:50 +00:00
|
|
|
}
|