forked from Cylo-Traders/Agrocylo-PIP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfiguration.ts
More file actions
71 lines (67 loc) · 2.01 KB
/
Copy pathconfiguration.ts
File metadata and controls
71 lines (67 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* Strongly typed application configuration loaded from environment variables.
* Consumed via `ConfigService` throughout the application.
*/
export interface AppConfig {
nodeEnv: string;
port: number;
logLevel: string;
corsAllowedOrigins: string[];
}
export interface ThrottleConfig {
ttlMs: number;
limit: number;
}
export interface DbConfig {
url: string;
}
export interface SorobanConfig {
rpcUrl: string;
networkPassphrase: string;
productionEscrowContractId: string;
escrowContractId: string;
eventPollIntervalMs: number;
eventRetentionDays: number;
/** Ledger to start indexing from when no persisted cursor exists yet. */
indexerStartLedger?: number;
}
export default (): {
app: AppConfig;
db: DbConfig;
soroban: SorobanConfig;
throttle: ThrottleConfig;
} => ({
app: {
nodeEnv: process.env.NODE_ENV ?? 'development',
port: parseInt(process.env.PORT ?? '3000', 10),
logLevel: process.env.LOG_LEVEL ?? 'info',
corsAllowedOrigins: (process.env.CORS_ALLOWED_ORIGINS ?? '')
.split(',')
.map((origin) => origin.trim())
.filter((origin) => origin.length > 0),
},
db: {
url: process.env.DATABASE_URL ?? 'file:./dev.db',
},
soroban: {
rpcUrl:
process.env.SOROBAN_RPC_URL ?? 'https://soroban-testnet.stellar.org',
networkPassphrase:
process.env.SOROBAN_NETWORK_PASSPHRASE ??
'Test SDF Network ; September 2015',
productionEscrowContractId: process.env.PRODUCTION_ESCROW_CONTRACT_ID ?? '',
escrowContractId: process.env.ESCROW_CONTRACT_ID ?? '',
eventPollIntervalMs: parseInt(
process.env.EVENT_POLL_INTERVAL_MS ?? '5000',
10,
),
eventRetentionDays: parseInt(process.env.EVENT_RETENTION_DAYS ?? '7', 10),
indexerStartLedger: process.env.SOROBAN_INDEXER_START_LEDGER
? parseInt(process.env.SOROBAN_INDEXER_START_LEDGER, 10)
: undefined,
},
throttle: {
ttlMs: parseInt(process.env.THROTTLE_TTL_MS ?? '60000', 10),
limit: parseInt(process.env.THROTTLE_LIMIT ?? '100', 10),
},
});