mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
21 lines
472 B
TypeScript
21 lines
472 B
TypeScript
import { SiteConfig } from 'epg-grabber'
|
|
import _ from 'lodash'
|
|
import { pathToFileURL } from 'url'
|
|
|
|
export class ConfigLoader {
|
|
async load(filepath: string): Promise<SiteConfig> {
|
|
const fileUrl = pathToFileURL(filepath).toString()
|
|
const config = (await import(fileUrl)).default
|
|
|
|
return _.merge(
|
|
{
|
|
delay: 0,
|
|
maxConnections: 1,
|
|
request: {
|
|
timeout: 30000
|
|
}
|
|
},
|
|
config
|
|
)
|
|
}
|
|
}
|