refactoring the utils
This commit is contained in:
@@ -4,9 +4,15 @@ common:
|
||||
Content-Type: application/json
|
||||
sandbox:
|
||||
api_base_url: https://sandbox-nym-api1.nymtech.net/api/v1
|
||||
mix_id: 7
|
||||
identity_key: 2wEzyW6Pihk19xbCK9kB81vYuDFUvTzTAr77arvxdfSg
|
||||
gateway_identity: HjNEDJuotWV8VD4ufeA1jeheTnfNJ7Jorevp57hgaZua
|
||||
log_level: error
|
||||
time_zone: utc
|
||||
prod:
|
||||
api_base_url: https://validator.nymtech.net/api/v1
|
||||
mix_id: 730
|
||||
mixnode_identity: 3pMCJswCyA19MGYWGDWT5fBk2M8ybSZGXttyAoNY5gBB
|
||||
gateway_identity: 2BuMSfMW3zpeAjKXyKLhmY4QW1DXurrtSPEJ6CjX3SEh
|
||||
log_level: error
|
||||
time_zone: utc
|
||||
time_zone: utc
|
||||
@@ -40,9 +40,8 @@ class ConfigHandler {
|
||||
private setCommonConfig(): void {
|
||||
try {
|
||||
const baseWorkingDirectory = __dirname;
|
||||
console.log(`Base Working Directory: ${baseWorkingDirectory}`);
|
||||
this.commonConfig = YAML.parse(
|
||||
readFileSync("/Users/benedetta/nym/workspace/nym/common/api-test-utils/config/config.yaml", "utf8"),
|
||||
readFileSync(baseWorkingDirectory + "/config.yaml", "utf8"),
|
||||
).common;
|
||||
} catch (error) {
|
||||
throw Error(`Error reading common config: (${error})`);
|
||||
@@ -52,8 +51,9 @@ class ConfigHandler {
|
||||
private setEnvironmentConfig(environment: string): void {
|
||||
this.ensureEnvironmentIsValid(environment);
|
||||
try {
|
||||
const baseWorkingDirectory = __dirname;
|
||||
this.environmentConfig = YAML.parse(
|
||||
readFileSync("/Users/benedetta/nym/workspace/nym/common/api-test-utils/config/config.yaml", "utf8"),
|
||||
readFileSync(baseWorkingDirectory + "/config.yaml", "utf8"),
|
||||
)[environment];
|
||||
} catch (error) {
|
||||
console.log("fadsfasdfasdfsdfsa")
|
||||
@@ -62,9 +62,10 @@ class ConfigHandler {
|
||||
}
|
||||
|
||||
public getEnvironmentConfig(environment: string): any {
|
||||
const baseWorkingDirectory = __dirname;
|
||||
return (
|
||||
this.environmentConfig ||
|
||||
YAML.parse(readFileSync("api-test-utils/config/config.yaml", "utf8"))[environment]
|
||||
YAML.parse(readFileSync(baseWorkingDirectory + "/config.yaml", "utf8"))[environment]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user