Пример #1
0
        public void Init(NameValueCollection appSettings)
        {
            Config = new ApiConfig();
            Config.Maintainance       = bool.Parse(appSettings["maintainance"]);
            Config.AuthTicketDuration = int.Parse(appSettings["authTicketDuration"]);
            Config.Regkey             = appSettings["regkey"];
            Config.Secret             = appSettings["secret"];
            Config.UpdateUrl          = appSettings["updateUrl"];
            Config.CDNUrl             = appSettings["cdnUrl"];
            Config.NFSdir             = appSettings["nfsdir"];
            Config.UseProxy           = bool.Parse(appSettings["useProxy"]);
            Config.UpdateID           = (appSettings["updateID"] == "") ? (int?)null : int.Parse(appSettings["updateID"]);
            Config.BranchName         = appSettings["branchName"] ?? "beta";

            // new smtp config vars
            if (appSettings["smtpHost"] != null &&
                appSettings["smtpUser"] != null &&
                appSettings["smtpPassword"] != null &&
                appSettings["smtpPort"] != null)
            {
                Config.SmtpEnabled  = true;
                Config.SmtpHost     = appSettings["smtpHost"];
                Config.SmtpUser     = appSettings["smtpUser"];
                Config.SmtpPassword = appSettings["smtpPassword"];
                Config.SmtpPort     = int.Parse(appSettings["smtpPort"]);
            }

            JWT = new JWTFactory(new JWTConfiguration()
            {
                Key = System.Text.UTF8Encoding.UTF8.GetBytes(Config.Secret)
            });

            DAFactory = new MySqlDAFactory(new Database.DatabaseConfiguration()
            {
                ConnectionString = appSettings["connectionString"]
            });

            Shards = new Shards(DAFactory);
            Shards.AutoUpdate();
        }
Пример #2
0
        public void Init(NameValueCollection appSettings)
        {
            Config = new ApiConfig();
            Config.Maintainance       = bool.Parse(appSettings["maintainance"]);
            Config.AuthTicketDuration = int.Parse(appSettings["authTicketDuration"]);
            Config.Regkey             = appSettings["regkey"];
            Config.Secret             = appSettings["secret"];
            Config.UpdateUrl          = appSettings["updateUrl"];
            Config.NFSdir             = appSettings["nfsdir"];

            JWT = new JWTFactory(new JWTConfiguration()
            {
                Key = System.Text.UTF8Encoding.UTF8.GetBytes(Config.Secret)
            });

            DAFactory = new MySqlDAFactory(new Database.DatabaseConfiguration()
            {
                ConnectionString = appSettings["connectionString"]
            });

            Shards = new Shards(DAFactory);
            Shards.AutoUpdate();
        }