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 let public CreateConfig (name: string) = match Environment.GetEnvironmentVariable(name) with | null -> raise <| ApplicationException("Missing config path env") | path -> ReadConfig <| path