diff --git a/.env.sample b/.env.sample index f2fd0c9..49ec8fe 100644 --- a/.env.sample +++ b/.env.sample @@ -4,6 +4,6 @@ RACK_ENV=development TZ=Europe/Prague RAISE_ERRORS=true FORCE_SSL=false -TIMEOUT=false +RACK_TIMEOUT=false DOMAIN=example.com SYNC_SCHEDULE=0 */12 * * * diff --git a/Rakefile b/Rakefile index 4d1d776..76ce904 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,3 @@ require 'pliny/tasks' Dir['./lib/tasks/*.rake'].each { |task| load task } task :default => :spec - - - diff --git a/config/config.rb b/config/config.rb index 17e6d19..b5a001c 100644 --- a/config/config.rb +++ b/config/config.rb @@ -26,7 +26,7 @@ module Config # Override -- value is returned or the set default. override :database_timeout, 10, int - override :db_pool, 5, int + override :db_pool_max_size, 3, int override :deployment, 'production', string override :elastic_prefix, 'sirius', string override :force_ssl, true, bool @@ -34,14 +34,14 @@ module Config override :oauth_auth_uri, 'https://auth.fit.cvut.cz/oauth/authorize', string override :oauth_token_uri, 'https://auth.fit.cvut.cz/oauth/token', string override :umapi_people_uri, 'https://kosapi.fit.cvut.cz/usermap/v1/people', string - override :umapi_privileged_roles, 'B-00000-ZAMESTNANEC', array(string) + override :umapi_privileged_roles, 'B-00000-SUMA-ZAMESTNANEC', array(string) override :port, 5000, int override :pretty_json, false, bool override :rack_env, 'development', string override :raise_errors, false, bool override :root, File.expand_path('../', __dir__), string - override :timeout, 10, int + override :rack_timeout, 10, int override :tz, 'Europe/Prague', string override :versioning, false, bool diff --git a/config/initializers/database.rb b/config/initializers/database.rb index 8e9f2c9..8ded67d 100644 --- a/config/initializers/database.rb +++ b/config/initializers/database.rb @@ -7,7 +7,7 @@ # while Sequel expects 'postgres' adapter db_url = Config.database_url.sub(/\Apostgresql:/, 'postgres:') -DB = Sequel.connect(db_url, max_connections: Config.db_pool) +DB = Sequel.connect(db_url, max_connections: Config.db_pool_max_size) # Log level at which to log SQL queries. DB.sql_log_level = :debug diff --git a/config/initializers/timeout.rb b/config/initializers/timeout.rb index 4f42b04..a27cd74 100644 --- a/config/initializers/timeout.rb +++ b/config/initializers/timeout.rb @@ -1,5 +1,7 @@ +require 'logger' require 'rack-timeout' -if Config.timeout > 0 - Rack::Timeout.timeout = Config.timeout +if Config.rack_timeout > 0 + Rack::Timeout.timeout = Config.rack_timeout + Rack::Timeout::Logger.level = Logger::WARN end diff --git a/lib/routes.rb b/lib/routes.rb index 109eabc..b08e2b4 100644 --- a/lib/routes.rb +++ b/lib/routes.rb @@ -3,7 +3,7 @@ Routes = Rack::Builder.new do use Pliny::Middleware::RescueErrors, raise: Config.raise_errors? use Pliny::Middleware::CORS - use Rack::Timeout if Config.timeout > 0 + use Rack::Timeout if Config.rack_timeout > 0 use Raven::Rack if Config.sentry_dsn use Rack::Deflater use Rack::MethodOverride diff --git a/vagga.yaml b/vagga.yaml index 5016888..1a4e74a 100644 --- a/vagga.yaml +++ b/vagga.yaml @@ -96,4 +96,3 @@ commands: children: postgres: *postgres elastic: *elastic -