Пример #1
0
 public void Startup(ConfigurationLoader loader)
 {
     m_GatekeeperUri           = loader.GatekeeperURI;
     m_Scenes                  = loader.Scenes;
     m_ExternalHostNameService = loader.ExternalHostNameService;
     m_SceneFactory            = loader.GetService <SceneFactoryInterface>("DefaultSceneImplementation");
     m_RegionService           = loader.GetService <GridServiceInterface>(m_RegionStorage);
 }
Пример #2
0
 public void ObtainCertificate(string filename, ExternalHostNameServiceInterface externalHostNameService)
 {
     if (!File.Exists(filename))
     {
         m_Log.Warn("Generating self-signed cert");
         try
         {
             SslSelfSignCertUtil.GenerateSelfSignedServiceCertificate(filename, externalHostNameService.ExternalHostName);
         }
         catch (Exception e)
         {
             m_Log.Error("Creating self-signed cert failed", e);
             throw new ConfigurationLoader.ConfigurationErrorException("Creating self-signed cert failed");
         }
     }
 }
Пример #3
0
        public void Startup(ConfigurationLoader loader)
        {
            m_ExternalHostNameService = loader.ExternalHostNameService;
            if (Scheme == Uri.UriSchemeHttps)
            {
                if (string.IsNullOrEmpty(m_CertificateObtainServiceName))
                {
                    m_CertificateObtainService = new SelfSignedObtainService();
                }
                else
                {
                    loader.GetService(m_CertificateObtainServiceName, out m_CertificateObtainService);
                }
            }

            m_CertificateObtainService?.ObtainCertificate(m_CertificateFileName, m_ExternalHostNameService);

            if (Scheme == Uri.UriSchemeHttps)
            {
                try
                {
                    m_ServerCertificate = new X509Certificate2(m_CertificateFileName);
                }
                catch (Exception e)
                {
                    m_Log.Error("Loading certificate failed", e);
                    throw new ConfigurationLoader.ConfigurationErrorException("Loading certificate failed");
                }
                m_CertificateWatcher = new FileSystemWatcher
                {
                    Path         = Path.GetDirectoryName(m_CertificateFileName),
                    Filter       = Path.GetFileName(m_CertificateFileName),
                    NotifyFilter = NotifyFilters.LastWrite
                };
                m_CertificateWatcher.Changed            += OnCertChanged;
                m_CertificateWatcher.Created            += OnCertChanged;
                m_CertificateWatcher.EnableRaisingEvents = true;

                m_Log.InfoFormat("Starting HTTPS Server");
            }
            else
            {
                m_Log.InfoFormat("Starting HTTP Server");
            }
        }
Пример #4
0
 public void Startup(ConfigurationLoader loader)
 {
     m_ExternalHostNameService = loader.ExternalHostNameService;
 }