/// <summary> /// Load configuration into a Connec configuration object /// </summary> /// <returns>A Connec configuration object</returns> public static Connec Load(string preset = "maestrano") { var config = ConfigurationManager.GetSection(preset + "/connec") as Connec; if (config == null) config = new Connec(); return config; }
/// <summary> /// Load configuration into a Connec configuration object from a JObject /// </summary> /// <returns>A Connec configuration object</returns> public static Connec LoadFromJson(JObject obj) { var config = new Connec(); config.Host = obj["host"].ToString(); config.BasePath = obj["base_path"].ToString(); return(config); }
public Preset(JObject obj) { Marketplace = obj["marketplace"].Value <string>(); App = App.LoadFromJson(obj["app"].Value <JObject>()); Api = Api.LoadFromJson(obj["api"].Value <JObject>()); Connec = Connec.LoadFromJson(obj["connec"].Value <JObject>()); Webhook = Webhook.LoadFromJson(obj["webhooks"].Value <JObject>()); Sso = Sso.LoadFromJson(Marketplace, App, Api, obj["sso"].Value <JObject>()); }
/// <summary> /// Constructor only used for testing /// </summary> /// <param name="marketplace">The marketplace (e.g.: maestrano)</param> public Preset(string marketplace) { Marketplace = marketplace; App = new App(); Api = new Api(); Connec = new Connec(); Webhook = new Webhook(); Sso = new Sso(marketplace, Api); }
/// <summary> /// Constructor /// </summary> /// <param name="name">The preset name (e.g.: maestrano)</param> public Preset(string name) { Name = name; App = App.Load(name); Api = Api.Load(name); Connec = Connec.Load(name); Webhook = Webhook.Load(name); Sso = Sso.Load(name); }
/// <summary> /// Load configuration into a Connec configuration object /// </summary> /// <returns>A Connec configuration object</returns> public static Connec Load() { var config = ConfigurationManager.GetSection("maestrano/connec") as Connec; if (config == null) { config = new Connec(); } return(config); }
/// <summary> /// Load configuration into a Connec configuration object /// </summary> /// <returns>A Connec configuration object</returns> public static Connec Load(string preset = "maestrano") { var config = ConfigurationManager.GetSection(preset + "/connec") as Connec; if (config == null) { config = new Connec(); } return(config); }
/// <summary> /// Load configuration into a Connec configuration object /// </summary> /// <returns>A Connec configuration object</returns> public static Connec Load(string preset = "maestrano") { ConfigurationManager.RefreshSection(preset + "/connec"); var config = ConfigurationManager.GetSection(preset + "/connec") as Connec; if (config == null) { config = new Connec(); } config.presetName = preset; return(config); }