-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.ts
More file actions
121 lines (120 loc) · 2.93 KB
/
Copy pathcli.ts
File metadata and controls
121 lines (120 loc) · 2.93 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
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
110
111
112
113
114
115
116
117
118
119
120
121
import type { ArgDictionaryItem } from "@joyautomation/conch";
import type { Args } from "@std/cli";
import { setLogLevel } from "@joyautomation/coral";
import { logs } from "./log.ts";
/**
* A dictionary of command-line arguments and their properties.
* @type {Object.<string, ArgDictionaryItem>}
*/
export const argDictionary: Record<string, ArgDictionaryItem> = {
log_level: {
short: "l",
type: "string",
description: "Set the log level",
env: "MANTLE_LOG_LEVEL",
action: (args?: Args) => {
setLogLevel(logs.synapse.main, args?.["log_level"]);
setLogLevel(logs.mantle.main, args?.["log_level"]);
},
},
migrate: {
short: "m",
description: "Run the database migrations",
action: async (args?: Args) => {
const { runMigrations } = await import("./db/migration.ts");
await runMigrations(args);
},
exit: true,
type: "boolean",
},
"broker-url": {
short: "b",
description: "Set the URL for MQTT Broker",
env: "MANTLE_MQTT_BROKER_URL",
type: "string",
},
username: {
short: "u",
description: "Set the username for MQTT Broker",
env: "MANTLE_MQTT_USERNAME",
type: "string",
},
password: {
short: "p",
description: "Set the password for MQTT Broker",
env: "MANTLE_MQTT_PASSWORD",
type: "string",
},
"client-id": {
short: "c",
description: "Set the MQTT Client ID",
env: "MANTLE_MQTT_CLIENT_ID",
type: "string",
},
"db-host": {
short: "D",
description: "Set the database host",
env: "MANTLE_DB_HOST",
type: "string",
},
"db-port": {
short: "P",
description: "Set the database port",
env: "MANTLE_DB_PORT",
type: "string",
},
"db-user": {
short: "U",
description: "Set the database user",
env: "MANTLE_DB_USER",
type: "string",
},
"db-password": {
short: "W",
description: "Set the database password",
env: "MANTLE_DB_PASSWORD",
type: "string",
},
"db-name": {
short: "N",
description: "Set the database name",
env: "MANTLE_DB_NAME",
type: "string",
},
"db-admin-name": {
short: "A",
description: "Set the database admin name",
env: "MANTLE_DB_ADMIN_NAME",
type: "string",
},
"db-admin-password": {
short: "W",
description: "Set the database admin password",
env: "MANTLE_DB_ADMIN_PASSWORD",
type: "string",
},
"db-ssl": {
short: "S",
description: "SSL mode for database connection",
env: "MANTLE_DB_SSL",
type: "boolean",
},
"db-ssl-ca": {
short: "C",
description: "Path to the root certificate for the database SSL connection",
env: "MANTLE_DB_SSL_CA",
type: "string",
},
"shared-group": {
short: "g",
description: "Shared subscription group for DDATA and NDATA messages",
env: "MANTLE_SHARED_GROUP",
type: "string",
},
"redis-url": {
short: "R",
description: "Redis URL",
env: "MANTLE_REDIS_URL",
type: "string",
},
};