Skip to content

Commit 283a8af

Browse files
committed
cmd/catalyst: cleanup
1 parent cd47fc5 commit 283a8af

File tree

2 files changed

+35
-39
lines changed

2 files changed

+35
-39
lines changed

cmd/catalyst/config/config.go

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func readYAMLFile(filePath string) (map[string]any, error) {
9696
return jsonMap, nil
9797
}
9898

99+
// Return a (mutable) reference to the map at the given key, returning an empty one if none present
99100
func optionalMap(parent map[string]any, key string) (map[string]any, error) {
100101
child, ok := parent[key]
101102
if !ok {
@@ -108,42 +109,3 @@ func optionalMap(parent map[string]any, key string) (map[string]any, error) {
108109
}
109110
return childMap, nil
110111
}
111-
112-
func handleConfigFile(configPath string) (string, error) {
113-
var conf map[any]any
114-
dat, err := os.ReadFile(configPath)
115-
if err != nil {
116-
return "", err
117-
}
118-
err = yaml.Unmarshal(dat, &conf)
119-
if err != nil {
120-
return "", err
121-
}
122-
jsonConf := dyno.ConvertMapI2MapS(conf)
123-
jsonMap, ok := jsonConf.(map[string]any)
124-
if !ok {
125-
return "", fmt.Errorf("unable to convert config to a string map")
126-
}
127-
config, err := optionalMap(jsonMap, "config")
128-
if err != nil {
129-
return "", err
130-
}
131-
protocols, err := optionalMap(config, "protocols")
132-
if err != nil {
133-
return "", err
134-
}
135-
protocolArray := []map[string]any{}
136-
for k, v := range protocols {
137-
vMap, ok := v.(map[string]any)
138-
if !ok {
139-
return "", fmt.Errorf("unable to convert protocol '%s' to a string map", k)
140-
}
141-
protocolArray = append(protocolArray, vMap)
142-
}
143-
config["protocols"] = protocolArray
144-
str, err := json.MarshalIndent(jsonConf, "", " ")
145-
if err != nil {
146-
return "", err
147-
}
148-
return string(str), nil
149-
}

config/full-stack.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@ config:
1616
protocols:
1717
livepeer-cockroach:
1818
connector: livepeer-cockroach
19+
1920
livepeer-rabbitmq:
2021
connector: livepeer-rabbitmq
22+
2123
livepeer-nginx:
2224
connector: livepeer-nginx
25+
2326
livepeer-minio:
2427
connector: livepeer-minio
28+
2529
livepeer-core-dump-monitor:
2630
connector: livepeer-core-dump-monitor
31+
2732
livepeer-coturn:
2833
connector: livepeer-coturn
34+
2935
livepeer-api:
3036
connector: livepeer-api
3137
postgres-url: postgresql://root@localhost:5432/defaultdb?sslmode=disable
@@ -45,12 +51,14 @@ config:
4551
vodCatalystPrivateAssetsObjectStore: cab9266f-5583-4532-9630-7be10d92affe
4652
recordCatalystObjectStoreId: 0926e4ba-b726-4386-92ee-5c4583f62f0a
4753
own-region: box
54+
4855
livepeer-stream-info-service:
4956
connector: livepeer-api
5057
postgres-url: postgresql://root@localhost:5432/defaultdb?sslmode=disable
5158
own-region: box
5259
stream-info-service: true
5360
port: "3040"
61+
5462
livepeer-catalyst-api:
5563
connector: livepeer-catalyst-api
5664
api-server: http://127.0.0.1:3004
@@ -64,6 +72,7 @@ config:
6472
own-region: box
6573
v: "8"
6674
broadcaster-url: http://127.0.0.1:8937
75+
6776
livepeer-broadcaster:
6877
connector: livepeer
6978
broadcaster: true
@@ -78,6 +87,7 @@ config:
7887
http://9c2936b5-143f-4b10-b302-6a21b5f29c3d:[email protected]:3004/api/stream/hook
7988
metadataQueueUri: amqp://localhost:5672/livepeer
8089
v: "2"
90+
8191
livepeer-broadcaster-vod:
8292
connector: livepeer
8393
broadcaster: true
@@ -89,6 +99,7 @@ config:
8999
orchAddr: 127.0.0.1:8936
90100
rtmpAddr: 127.0.0.1:1937
91101
v: "2"
102+
92103
livepeer-orchestrator:
93104
connector: livepeer
94105
orchestrator: true
@@ -99,13 +110,15 @@ config:
99110
monitor: true
100111
serviceAddr: 127.0.0.1:8936
101112
v: "2"
113+
102114
livepeer-analyzer:
103115
connector: livepeer-analyzer
104116
livepeer-access-token: f61b3cdb-d173-4a7a-a0d3-547b871a56f9
105117
port: "3080"
106118
rabbitmq-uri: amqp://localhost:5672/livepeer
107119
disable-bigquery: true
108120
v: "8"
121+
109122
livepeer-task-runner:
110123
connector: livepeer-task-runner
111124
amqp-uri: amqp://localhost:5672/livepeer
@@ -114,44 +127,64 @@ config:
114127
livepeer-access-token: f61b3cdb-d173-4a7a-a0d3-547b871a56f9
115128
own-base-url: http://127.0.0.1:3060/task-runner
116129
port: "3060"
130+
117131
AAC:
118132
connector: AAC
133+
119134
CMAF:
120135
connector: CMAF
136+
121137
DTSC:
122138
connector: DTSC
139+
123140
EBML:
124141
connector: EBML
142+
125143
FLV:
126144
connector: FLV
145+
127146
H264:
128147
connector: H264
148+
129149
HDS:
130150
connector: HDS
151+
131152
HLS:
132153
connector: HLS
154+
133155
HTTP:
134156
connector: HTTP
157+
135158
HTTPTS:
136159
connector: HTTPTS
160+
137161
JSON:
138162
connector: JSON
163+
139164
MP3:
140165
connector: MP3
166+
141167
MP4:
142168
connector: MP4
169+
143170
OGG:
144171
connector: OGG
172+
145173
RTMP:
146174
connector: RTMP
175+
147176
RTSP:
148177
connector: RTSP
178+
149179
SRT:
150180
connector: SRT
181+
151182
TSSRT:
152183
connector: TSSRT
184+
153185
WAV:
154186
connector: WAV
187+
155188
WebRTC:
156189
connector: WebRTC
157190
bindhost: 127.0.0.1
@@ -161,6 +194,7 @@ config:
161194
urls: turn:localhost
162195
username: livepeer
163196
pubhost: 127.0.0.1
197+
164198
sessionInputMode: 15
165199
sessionOutputMode: 15
166200
sessionStreamInfoMode: 1

0 commit comments

Comments
 (0)