26 行
724 B
TypeScript
26 行
724 B
TypeScript
import yaml from "yaml"
|
|
import * as fs from "fs"
|
|
import {IAppConfig, TChannel} from "./types"
|
|
|
|
let appConfig: IAppConfig = yaml.parse(fs.readFileSync('config.yaml', 'utf-8'))
|
|
let channels: TChannel[] = []
|
|
for (let course of appConfig.monit?.list || []) {
|
|
if (!channels.includes(course.channel)) {
|
|
channels.push(course.channel)
|
|
}
|
|
}
|
|
for (let course of appConfig.acquire?.list || []) {
|
|
if (!channels.includes(course.channel)) {
|
|
channels.push(course.channel)
|
|
}
|
|
}
|
|
if (appConfig.replace) {
|
|
for (let course of appConfig.replace.list) {
|
|
if (!channels.includes(course.channel)) {
|
|
channels.push(course.channel)
|
|
}
|
|
}
|
|
}
|
|
appConfig.channels = channels
|
|
export {appConfig}
|