Skip to content

Commit 0e67bc5

Browse files
committed
Updated configs
1 parent 661328d commit 0e67bc5

File tree

26 files changed

+148
-166
lines changed

26 files changed

+148
-166
lines changed

packages/apps/fortune/exchange-oracle/server/ENV.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
# Environment Variables
22

3-
### The URL for connecting to the PostgreSQL database. Required
3+
### The URL for connecting to the PostgreSQL database.
44
POSTGRES_URL=
55

6-
### The hostname or IP address of the PostgreSQL database server. Required
7-
POSTGRES_HOST=
6+
### The hostname or IP address of the PostgreSQL database server. Default: '127.0.0.1'
7+
POSTGRES_HOST="127.0.0.1"
88

9-
### The port number on which the PostgreSQL database server is listening. Required
10-
POSTGRES_PORT=
9+
### The port number on which the PostgreSQL database server is listening. Default: 5432
10+
POSTGRES_PORT="5432"
1111

12-
### The username for authenticating with the PostgreSQL database. Required
13-
POSTGRES_USER=
12+
### The username for authenticating with the PostgreSQL database. Default: 'operator'
13+
POSTGRES_USER="operator"
1414

15-
### The password for authenticating with the PostgreSQL database. Required
16-
POSTGRES_PASSWORD=
15+
### The password for authenticating with the PostgreSQL database. Default: 'qwerty'
16+
POSTGRES_PASSWORD="qwerty"
1717

1818
### The name of the PostgreSQL database to connect to. Default: 'exchange-oracle'
1919
POSTGRES_DATABASE="exchange-oracle"
2020

2121
### Indicates whether to use SSL for connections to the PostgreSQL database. Default: false
2222
POSTGRES_SSL="false"
2323

24-
### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Required
25-
POSTGRES_LOGGING=
24+
### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Default: 'log,info,warn,error'
25+
POSTGRES_LOGGING="log,info,warn,error"
2626

27-
### The RPC URL for the Sepolia network. Required
27+
### The RPC URL for the Sepolia network.
2828
RPC_URL_SEPOLIA=
2929

30-
### The RPC URL for the Polygon network. Required
30+
### The RPC URL for the Polygon network.
3131
RPC_URL_POLYGON=
3232

33-
### The RPC URL for the Polygon Amoy network. Required
33+
### The RPC URL for the Polygon Amoy network.
3434
RPC_URL_POLYGON_AMOY=
3535

36-
### The RPC URL for the BSC Mainnet network. Required
36+
### The RPC URL for the BSC Mainnet network.
3737
RPC_URL_BSC_MAINNET=
3838

39-
### The RPC URL for the BSC Testnet network. Required
39+
### The RPC URL for the BSC Testnet network.
4040
RPC_URL_BSC_TESTNET=
4141

42-
### The RPC URL for the Moonbeam network. Required
42+
### The RPC URL for the Moonbeam network.
4343
RPC_URL_MOONBEAM=
4444

45-
### The RPC URL for the XLayer network. Required
45+
### The RPC URL for the XLayer network.
4646
RPC_URL_XLAYER=
4747

48-
### The RPC URL for the Localhost network. Required
48+
### The RPC URL for the Localhost network.
4949
RPC_URL_LOCALHOST=
5050

5151
### Indicates whether PGP encryption should be used. Default: false
5252
PGP_ENCRYPT="false"
5353

54-
### The private key used for PGP encryption or decryption. Required
54+
### The private key used for PGP encryption or decryption.
5555
PGP_PRIVATE_KEY=
5656

57-
### The passphrase associated with the PGP private key. Required
57+
### The passphrase associated with the PGP private key.
5858
PGP_PASSPHRASE=
5959

6060
### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1'

packages/apps/fortune/exchange-oracle/server/scripts/generate-env-doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ function extractEnvVarsWithComments(content: string) {
3838
const envVar = match[1];
3939
const additionalOptions = match[2]; // capture additional options
4040

41+
// Skip variables without comments
42+
if (!comments[commentIndex]) {
43+
commentIndex++;
44+
continue;
45+
}
46+
4147
if (!envVarsMap.has(envVar)) {
4248
const comment = comments[commentIndex] || '';
4349
let required = false;

packages/apps/fortune/exchange-oracle/server/src/common/config/database-config.service.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,48 @@ export class DatabaseConfigService {
77

88
/**
99
* The URL for connecting to the PostgreSQL database.
10-
* Required
1110
*/
1211
get url(): string | undefined {
1312
return this.configService.get<string>('POSTGRES_URL');
1413
}
1514

1615
/**
1716
* The hostname or IP address of the PostgreSQL database server.
18-
* Required
17+
* Default: '127.0.0.1'
1918
*/
20-
get host(): string | undefined {
21-
return this.configService.get<string>('POSTGRES_HOST');
19+
get host(): string {
20+
return this.configService.get<string>('POSTGRES_HOST', '127.0.0.1');
2221
}
2322

2423
/**
2524
* The port number on which the PostgreSQL database server is listening.
26-
* Required
25+
* Default: 5432
2726
*/
28-
get port(): number | undefined {
29-
return this.configService.get<number>('POSTGRES_PORT');
27+
get port(): number {
28+
return +this.configService.get<number>('POSTGRES_PORT', 5432);
3029
}
3130

3231
/**
3332
* The username for authenticating with the PostgreSQL database.
34-
* Required
33+
* Default: 'operator'
3534
*/
36-
get user(): string | undefined {
37-
return this.configService.get<string>('POSTGRES_USER');
35+
get user(): string {
36+
return this.configService.get<string>('POSTGRES_USER', 'operator');
3837
}
3938

4039
/**
4140
* The password for authenticating with the PostgreSQL database.
42-
* Required
41+
* Default: 'qwerty'
4342
*/
44-
get password(): string | undefined {
45-
return this.configService.get<string>('POSTGRES_PASSWORD');
43+
get password(): string {
44+
return this.configService.get<string>('POSTGRES_PASSWORD', 'qwerty');
4645
}
4746

4847
/**
4948
* The name of the PostgreSQL database to connect to.
5049
* Default: 'exchange-oracle'
5150
*/
52-
get database(): string | undefined {
51+
get database(): string {
5352
return this.configService.get<string>(
5453
'POSTGRES_DATABASE',
5554
'exchange-oracle',
@@ -66,9 +65,9 @@ export class DatabaseConfigService {
6665

6766
/**
6867
* The logging level for PostgreSQL operations (e.g., 'debug', 'info').
69-
* Required
68+
* Default: 'log,info,warn,error'
7069
*/
7170
get logging(): string {
72-
return this.configService.getOrThrow<string>('POSTGRES_LOGGING');
71+
return this.configService.get<string>('POSTGRES_LOGGING', 'log,info,warn,error');
7372
}
7473
}

packages/apps/fortune/exchange-oracle/server/src/common/config/env-schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export const envValidator = Joi.object({
3535
S3_USE_SSL: Joi.string(),
3636
// PGP
3737
PGP_ENCRYPT: Joi.boolean(),
38-
PGP_PRIVATE_KEY: Joi.string().required(),
39-
PGP_PASSPHRASE: Joi.string().required(),
38+
PGP_PRIVATE_KEY: Joi.string().optional(),
39+
PGP_PASSPHRASE: Joi.string().optional(),
4040
});

packages/apps/fortune/exchange-oracle/server/src/common/config/network-config.service.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class NetworkConfigService {
2222
chainId: ChainId.SEPOLIA,
2323
/**
2424
* The RPC URL for the Sepolia network.
25-
* Required
2625
*/
2726
rpcUrl: this.configService.get<string>('RPC_URL_SEPOLIA'),
2827
},
@@ -32,7 +31,6 @@ export class NetworkConfigService {
3231
chainId: ChainId.POLYGON,
3332
/**
3433
* The RPC URL for the Polygon network.
35-
* Required
3634
*/
3735
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON'),
3836
},
@@ -42,7 +40,6 @@ export class NetworkConfigService {
4240
chainId: ChainId.POLYGON_AMOY,
4341
/**
4442
* The RPC URL for the Polygon Amoy network.
45-
* Required
4643
*/
4744
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON_AMOY'),
4845
},
@@ -52,7 +49,6 @@ export class NetworkConfigService {
5249
chainId: ChainId.BSC_MAINNET,
5350
/**
5451
* The RPC URL for the BSC Mainnet network.
55-
* Required
5652
*/
5753
rpcUrl: this.configService.get<string>('RPC_URL_BSC_MAINNET'),
5854
},
@@ -62,7 +58,6 @@ export class NetworkConfigService {
6258
chainId: ChainId.BSC_TESTNET,
6359
/**
6460
* The RPC URL for the BSC Testnet network.
65-
* Required
6661
*/
6762
rpcUrl: this.configService.get<string>('RPC_URL_BSC_TESTNET'),
6863
},
@@ -72,7 +67,6 @@ export class NetworkConfigService {
7267
chainId: ChainId.MOONBEAM,
7368
/**
7469
* The RPC URL for the Moonbeam network.
75-
* Required
7670
*/
7771
rpcUrl: this.configService.get<string>('RPC_URL_MOONBEAM'),
7872
},
@@ -82,7 +76,6 @@ export class NetworkConfigService {
8276
chainId: ChainId.XLAYER,
8377
/**
8478
* The RPC URL for the XLayer network.
85-
* Required
8679
*/
8780
rpcUrl: this.configService.get<string>('RPC_URL_XLAYER'),
8881
},
@@ -92,7 +85,6 @@ export class NetworkConfigService {
9285
chainId: ChainId.LOCALHOST,
9386
/**
9487
* The RPC URL for the Localhost network.
95-
* Required
9688
*/
9789
rpcUrl: this.configService.get<string>('RPC_URL_LOCALHOST'),
9890
},

packages/apps/fortune/exchange-oracle/server/src/common/config/pgp-config.service.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ export class PGPConfigService {
1515

1616
/**
1717
* The private key used for PGP encryption or decryption.
18-
* Required
1918
*/
20-
get privateKey(): string {
21-
return this.configService.getOrThrow<string>('PGP_PRIVATE_KEY');
19+
get privateKey(): string | undefined {
20+
return this.configService.get<string>('PGP_PRIVATE_KEY');
2221
}
2322

2423
/**
2524
* The passphrase associated with the PGP private key.
26-
* Required
2725
*/
28-
get passphrase(): string {
29-
return this.configService.getOrThrow<string>('PGP_PASSPHRASE');
26+
get passphrase(): string | undefined {
27+
return this.configService.get<string>('PGP_PASSPHRASE');
3028
}
3129
}

packages/apps/fortune/recording-oracle/ENV.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
# Environment Variables
22

3-
### The RPC URL for the Polygon network. Required
3+
### The RPC URL for the Polygon network.
44
RPC_URL_POLYGON=
55

6-
### The RPC URL for the Polygon Amoy network. Required
6+
### The RPC URL for the Polygon Amoy network.
77
RPC_URL_POLYGON_AMOY=
88

9-
### The RPC URL for the Sepolia network. Required
9+
### The RPC URL for the Sepolia network.
1010
RPC_URL_SEPOLIA=
1111

12-
### The RPC URL for the BSC Mainnet network. Required
12+
### The RPC URL for the BSC Mainnet network.
1313
RPC_URL_BSC_MAINNET=
1414

15-
### The RPC URL for the BSC Testnet network. Required
15+
### The RPC URL for the BSC Testnet network.
1616
RPC_URL_BSC_TESTNET=
1717

18-
### The RPC URL for the Moonbeam network. Required
18+
### The RPC URL for the Moonbeam network.
1919
RPC_URL_MOONBEAM=
2020

21-
### The RPC URL for the Localhost network. Required
21+
### The RPC URL for the Localhost network.
2222
RPC_URL_LOCALHOST=
2323

2424
### Indicates whether PGP encryption should be used. Default: false
2525
PGP_ENCRYPT="false"
2626

27-
### The private key used for PGP encryption or decryption. Required
27+
### The private key used for PGP encryption or decryption.
2828
PGP_PRIVATE_KEY=
2929

30-
### The passphrase associated with the PGP private key. Required
30+
### The passphrase associated with the PGP private key.
3131
PGP_PASSPHRASE=
3232

3333
### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1'

packages/apps/fortune/recording-oracle/scripts/generate-env-doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ function extractEnvVarsWithComments(content: string) {
3838
const envVar = match[1];
3939
const additionalOptions = match[2]; // capture additional options
4040

41+
// Skip variables without comments
42+
if (!comments[commentIndex]) {
43+
commentIndex++;
44+
continue;
45+
}
46+
4147
if (!envVarsMap.has(envVar)) {
4248
const comment = comments[commentIndex] || '';
4349
let required = false;

packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ export const envValidator = Joi.object({
2424
S3_USE_SSL: Joi.string(),
2525
// Encryption
2626
PGP_ENCRYPT: Joi.boolean(),
27-
PGP_PRIVATE_KEY: Joi.string().required(),
28-
PGP_PASSPHRASE: Joi.string().required(),
27+
PGP_PRIVATE_KEY: Joi.string().optional(),
28+
PGP_PASSPHRASE: Joi.string().optional(),
2929
});

packages/apps/fortune/recording-oracle/src/common/config/network-config.service.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class NetworkConfigService {
2222
chainId: ChainId.POLYGON,
2323
/**
2424
* The RPC URL for the Polygon network.
25-
* Required
2625
*/
2726
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON'),
2827
},
@@ -32,7 +31,6 @@ export class NetworkConfigService {
3231
chainId: ChainId.POLYGON_AMOY,
3332
/**
3433
* The RPC URL for the Polygon Amoy network.
35-
* Required
3634
*/
3735
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON_AMOY'),
3836
},
@@ -42,7 +40,6 @@ export class NetworkConfigService {
4240
chainId: ChainId.SEPOLIA,
4341
/**
4442
* The RPC URL for the Sepolia network.
45-
* Required
4643
*/
4744
rpcUrl: this.configService.get<string>('RPC_URL_SEPOLIA'),
4845
},
@@ -52,7 +49,6 @@ export class NetworkConfigService {
5249
chainId: ChainId.BSC_MAINNET,
5350
/**
5451
* The RPC URL for the BSC Mainnet network.
55-
* Required
5652
*/
5753
rpcUrl: this.configService.get<string>('RPC_URL_BSC_MAINNET'),
5854
},
@@ -62,7 +58,6 @@ export class NetworkConfigService {
6258
chainId: ChainId.BSC_TESTNET,
6359
/**
6460
* The RPC URL for the BSC Testnet network.
65-
* Required
6661
*/
6762
rpcUrl: this.configService.get<string>('RPC_URL_BSC_TESTNET'),
6863
},
@@ -72,7 +67,6 @@ export class NetworkConfigService {
7267
chainId: ChainId.MOONBEAM,
7368
/**
7469
* The RPC URL for the Moonbeam network.
75-
* Required
7670
*/
7771
rpcUrl: this.configService.get<string>('RPC_URL_MOONBEAM'),
7872
},
@@ -82,7 +76,6 @@ export class NetworkConfigService {
8276
chainId: ChainId.LOCALHOST,
8377
/**
8478
* The RPC URL for the Localhost network.
85-
* Required
8679
*/
8780
rpcUrl: this.configService.get<string>('RPC_URL_LOCALHOST'),
8881
},

0 commit comments

Comments
 (0)