20 lines
474 B
Forth
20 lines
474 B
Forth
|
module PublishHelperBot.Environment
|
||
|
|
||
|
open System
|
||
|
open System.IO
|
||
|
open Newtonsoft.Json
|
||
|
|
||
|
type public BotConfig = {
|
||
|
token: string
|
||
|
relayUrl: string
|
||
|
chanelId: int64
|
||
|
adminChatId: int64
|
||
|
}
|
||
|
|
||
|
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
|