dashboard-rss/src/Server/Config.fs

15 lines
454 B
Forth

module Config
open System
open Newtonsoft.Json
type Config = {
feeds : string array }
// JSON is not a great format for configuration files. I would use TOML, but there don't seem to be good parsers for it which support idiomatic F# and can be nugetted
let parseConfig = JsonConvert.DeserializeObject<Config>
let readFile (filename : string) =
use sr = new IO.StreamReader(filename)
sr.ReadToEnd()
let loadConfig = readFile >> parseConfig