public HostPrefix FromServiceSubdomain(ServiceSubdomainAttribute attr) { HostPrefix result = this.CopyAs <HostPrefix>(); result.HostName = $"{attr.Subdomain}.{HostName}"; return(result); }
private void AddHostPrefix(HostPrefix hp) { _listening.TryAdd(hp, this); string path = hp.ToString(); _logger.AddEntry("HttpServer: {0}", path); _listener.Prefixes.Add(path); }
public AppConf(string name, int port = 8080, bool ssl = false) : this() { Name = name; GenerateDao = true; Bindings = new HostPrefix[] { new HostPrefix { HostName = name, Port = port, Ssl = ssl } }; }
public static HostPrefix GetConfiguredHostPrefix() { HostPrefix hostPrefix = new HostPrefix(); hostPrefix.HostName = DefaultConfiguration.GetAppSetting("HostName").Or("localhost"); hostPrefix.Port = int.Parse(DefaultConfiguration.GetAppSetting("Port")); hostPrefix.Ssl = bool.Parse(DefaultConfiguration.GetAppSetting("Ssl")); return(hostPrefix); }
public override bool Equals(object obj) { HostPrefix compareTo = obj as HostPrefix; if (compareTo != null) { return(compareTo.ToString().Equals(this.ToString())); } return(base.Equals(obj)); }
public static HostPrefix[] FromDefaultConfiguration(string defaultHostName = "localhost", int defaultPort = 80) { int port = int.Parse(DefaultConfiguration.GetAppSetting("Port", defaultPort.ToString())); bool ssl = DefaultConfiguration.GetAppSetting("Ssl").IsAffirmative(); List <HostPrefix> results = new List <HostPrefix>(); foreach (string hostName in DefaultConfiguration.GetAppSetting("HostNames").Or(defaultHostName).DelimitSplit(",", true)) { HostPrefix hostPrefix = new HostPrefix() { HostName = hostName, Port = port, Ssl = ssl }; results.Add(hostPrefix); Trace.Write($"Default Config Hostname: {hostPrefix.ToString()}"); } return(results.ToArray()); }
public static HostPrefix[] GetConfiguredHostPrefixes() { return(HostPrefix.FromDefaultConfiguration()); }