/
variables.mjs
109 lines (101 loc) · 2.73 KB
/
variables.mjs
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import path from "path";
import { fileURLToPath } from "url";
export const IS_DOCKER_RUN = process.env.DOCKER_RUN !== undefined;
export const IS_GOOGLE_CLOUD_RUN = process.env.K_SERVICE !== undefined;
export const IS_GCP_JOB = process.env.GOOGLE_CLOUD_RUN_JOB !== undefined;
export const dirname = () => path.dirname(fileURLToPath(import.meta.url));
export const redisUri = () => {
if (IS_GOOGLE_CLOUD_RUN || IS_GCP_JOB) {
return "redis://10.130.48.5:6379";
} else {
return "redis://127.0.0.1:6379";
}
};
export const rpcUri = () => "wss://rpc.hydradx.cloud";
export const sqlHost = () => {
if (IS_GOOGLE_CLOUD_RUN || IS_GCP_JOB) {
return "10.130.49.4";
} else {
return "127.0.0.1";
}
};
// TODO: move to env
export const sqlPort = () => 5432;
export const sqlUser = () => "squid";
export const sqlPass = () => "squid";
export const sqlDatabase = () => "squid";
export const JOBS = {
cacheCoingeckoTickersJob: "cache-coingecko-tickers-job",
cacheHydradxUiStatsTvlJob: "cache-hydradx-ui-stats-tvl-job",
cacheCoinmarketcapSummaryJob: "cache-coinmarketcap-summary-job",
};
export const CACHE_SETTINGS = {
coingeckoV1Pairs: {
key: "coingecko_v1_pairs",
expire_after: 60 * 60,
},
coingeckoV1Tickers: {
key: "coingecko_v1_tickers",
expire_after: 12 * 60,
},
hydradxUiV1StatsTvl: {
key: "hydradx-ui_v1_stats_tvl",
expire_after: 60 * 60,
},
hydradxUiV1StatsChartLrna: {
key: "hydradx-ui_v1_stats_chart_lrna",
expire_after: 10 * 60,
},
hydradxUiV1statsChartTvl: {
key: "hydradx-ui_v1_stats_chart_tvl",
expire_after: 10 * 60,
},
hydradxUiV1statsChartVolume: {
key: "hydradx-ui_v1_stats_chart_volume",
expire_after: 10 * 60,
},
hydradxUiV1StatsTvl: {
key: "hydradx-ui_v1_stats_tvl",
expire_after: 10 * 60,
},
hydradxUiV1StatsVolume: {
key: "hydradx-ui_v1_stats_volume",
expire_after: 60,
},
hydradxUiV1StatsFees: {
key: "hydradx-ui_v1_stats_fees",
expire_after: 10 * 60,
},
hydradxUiV1statsVolumeAlltime: {
key: "hydradx-ui_v1_stats_volume_alltime",
expire_after: 60,
},
hydradxUiV1StatsPrice: {
key: "hydradx-ui_v1_stats_current_price",
expire_after: 60,
},
defillamaV1Volume: {
key: "defillama_v1_volume",
expire_after: 10 * 60,
},
coinmarketcapV1Summary: {
key: "coinmarketcap_v1_summary",
expire_after: 12 * 60,
},
hydradxUiV2StatsFees: {
key: "hydradx-ui_v2_stats_fees",
expire_after: 10 * 60,
},
hydradxUiV2StatsTvl: {
key: "hydradx-ui_v2_stats_tvl",
expire_after: 60,
},
hydradxUiV2StatsVolume: {
key: "hydradx-ui_v2_stats_volume",
expire_after: 60,
},
hydradxUiV2statsVolumeAlltime: {
key: "hydradx-ui_v2_stats_volume_alltime",
expire_after: 60,
},
};