21 lines
497 B
Forth
21 lines
497 B
Forth
module PublishHelperBot.Environment
|
|
|
|
open System
|
|
open System.IO
|
|
open Newtonsoft.Json
|
|
|
|
type public BotConfig = {
|
|
token: string
|
|
relayUrl: string
|
|
chanelId: int64
|
|
adminChatId: int64
|
|
YoutubeDlUrl: string
|
|
}
|
|
|
|
let private ReadConfig =
|
|
File.ReadAllText >> JsonConvert.DeserializeObject<BotConfig>
|
|
|
|
let public CreateConfig (name: string) =
|
|
match Environment.GetEnvironmentVariable(name) with
|
|
| null -> raise <| ApplicationException("Missing config path env")
|
|
| path -> ReadConfig <| path |