Exemplo n.º 1
0
        public HostPrefix FromServiceSubdomain(ServiceSubdomainAttribute attr)
        {
            HostPrefix result = this.CopyAs <HostPrefix>();

            result.HostName = $"{attr.Subdomain}.{HostName}";
            return(result);
        }
Exemplo n.º 2
0
        private void AddHostPrefix(HostPrefix hp)
        {
            _listening.TryAdd(hp, this);
            string path = hp.ToString();

            _logger.AddEntry("HttpServer: {0}", path);
            _listener.Prefixes.Add(path);
        }
Exemplo n.º 3
0
 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
                                      } };
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public override bool Equals(object obj)
        {
            HostPrefix compareTo = obj as HostPrefix;

            if (compareTo != null)
            {
                return(compareTo.ToString().Equals(this.ToString()));
            }
            return(base.Equals(obj));
        }
Exemplo n.º 6
0
        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());
        }
Exemplo n.º 7
0
 public static HostPrefix[] GetConfiguredHostPrefixes()
 {
     return(HostPrefix.FromDefaultConfiguration());
 }