예제 #1
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            Username                 = Configuration.GetValue <string>("USERNAME");
            Password                 = Configuration.GetValue <string>("PASSWORD");
            BasePath                 = Configuration.GetValue <string>("BASE_PATH");
            WebRoot                  = Configuration.GetValue <string>("WEB_ROOT");
            ListenPort               = Configuration.GetValue <int>("LISTEN_PORT", 50000);
            OutputDirectory          = Configuration.GetValue <string>("OUTPUT_DIR");
            SharedDirectory          = Configuration.GetValue <string>("SHARED_DIR");
            SharedCacheTTL           = Configuration.GetValue <long>("SHARED_CACHE_TTL", 3600000); // 1 hour
            EnableDistributedNetwork = Configuration.GetValue <bool>("ENABLE_DNET", true);
            DistributedChildLimit    = Configuration.GetValue <int>("DNET_CHILD_LIMIT", 10);
            DiagnosticLevel          = Configuration.GetValue <DiagnosticLevel>("DIAGNOSTIC", DiagnosticLevel.Info);
            ConnectTimeout           = Configuration.GetValue <int>("CONNECT_TIMEOUT", 5000);
            InactivityTimeout        = Configuration.GetValue <int>("INACTIVITY_TIMEOUT", 15000);
            EnableSecurity           = Configuration.GetValue <bool>("ENABLE_SECURITY", true);
            SecurityTokenTTL         = Configuration.GetValue <int>("SECURITY_TOKEN_TTL", 604800000); // 7 days
            RoomMessageLimit         = Configuration.GetValue <int>("ROOM_MESSAGE_LIMIT", 250);
            ReadBufferSize           = Configuration.GetValue <int>("READ_BUFFER_SIZE", 16384);
            WriteBufferSize          = Configuration.GetValue <int>("WRITE_BUFFER_SIZE", 16384);

            JwtSigningKey = new SymmetricSecurityKey(PBKDF2.GetKey(Password));

            SharedFileCache = new SharedFileCache(SharedDirectory, SharedCacheTTL);
        }
예제 #2
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            Username                 = Configuration.GetValue <string>("USERNAME");
            Password                 = Configuration.GetValue <string>("PASSWORD");
            WebRoot                  = Configuration.GetValue <string>("WEBROOT");
            ListenPort               = Configuration.GetValue <int>("LISTEN_PORT", 50000);
            OutputDirectory          = Configuration.GetValue <string>("OUTPUT_DIR");
            SharedDirectory          = Configuration.GetValue <string>("SHARED_DIR");
            SharedCacheTTL           = Configuration.GetValue <long>("SHARED_CACHE_TTL", 900000); // 15 minutes
            EnableDistributedNetwork = Configuration.GetValue <bool>("ENABLE_DNET", true);
            DistributedChildLimit    = Configuration.GetValue <int>("DNET_CHILD_LIMIT", 10);
            DiagnosticLevel          = Configuration.GetValue <DiagnosticLevel>("DIAGNOSTIC", DiagnosticLevel.Info);
            ConnectTimeout           = Configuration.GetValue <int>("CONNECT_TIMEOUT", 5000);
            InactivityTimeout        = Configuration.GetValue <int>("INACTIVITY_TIMEOUT", 15000);
            EnableSecurity           = Configuration.GetValue <bool>("ENABLE_SECURITY", true);
            TokenTTL                 = Configuration.GetValue <int>("TOKEN_TTL", 86400000); // 24 hours

            JwtSigningKey = new SymmetricSecurityKey(PBKDF2.GetKey(Password));

            SharedFileCache = new SharedFileCache(SharedDirectory, SharedCacheTTL);
        }