X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/18fecbe7ae84981626f8532c3f3ac730a50ce02a..a7631a1ccb6e2a6925d00a06562e171c4ce4ea2f:/services/api/config/arvados_config.rb diff --git a/services/api/config/arvados_config.rb b/services/api/config/arvados_config.rb index 8d2544dde1..4f831160e9 100644 --- a/services/api/config/arvados_config.rb +++ b/services/api/config/arvados_config.rb @@ -16,6 +16,7 @@ # config:migrate to /etc/arvados/config.yml, you will be able to # delete application.yml and database.yml. +require "cgi" require 'config_loader' require 'open3' @@ -37,8 +38,8 @@ EOS # Real values will be copied from globals by omniauth_init.rb. For # now, assign some strings so the generic *.yml config loader # doesn't overwrite them or complain that they're missing. - Rails.configuration.Login["ProviderAppID"] = 'xxx' - Rails.configuration.Login["ProviderAppSecret"] = 'xxx' + Rails.configuration.Login["SSO"]["ProviderAppID"] = 'xxx' + Rails.configuration.Login["SSO"]["ProviderAppSecret"] = 'xxx' Rails.configuration.Services["SSO"]["ExternalURL"] = '//xxx' WARNED_OMNIAUTH_CONFIG = true end @@ -106,10 +107,11 @@ arvcfg.declare_config "Users.EmailSubjectPrefix", String, :email_subject_prefix arvcfg.declare_config "Users.UserNotifierEmailFrom", String, :user_notifier_email_from arvcfg.declare_config "Users.NewUserNotificationRecipients", Hash, :new_user_notification_recipients, ->(cfg, k, v) { arrayToHash cfg, "Users.NewUserNotificationRecipients", v } arvcfg.declare_config "Users.NewInactiveUserNotificationRecipients", Hash, :new_inactive_user_notification_recipients, method(:arrayToHash) -arvcfg.declare_config "Login.ProviderAppSecret", String, :sso_app_secret -arvcfg.declare_config "Login.ProviderAppID", String, :sso_app_id +arvcfg.declare_config "Login.SSO.ProviderAppSecret", String, :sso_app_secret +arvcfg.declare_config "Login.SSO.ProviderAppID", String, :sso_app_id arvcfg.declare_config "Login.LoginCluster", String arvcfg.declare_config "Login.RemoteTokenRefresh", ActiveSupport::Duration +arvcfg.declare_config "Login.TokenLifetime", ActiveSupport::Duration arvcfg.declare_config "TLS.Insecure", Boolean, :sso_insecure arvcfg.declare_config "Services.SSO.ExternalURL", String, :sso_provider_url arvcfg.declare_config "AuditLogs.MaxAge", ActiveSupport::Duration, :max_audit_log_age @@ -190,6 +192,7 @@ dbcfg.declare_config "PostgreSQL.Connection.password", String, :password dbcfg.declare_config "PostgreSQL.Connection.dbname", String, :database dbcfg.declare_config "PostgreSQL.Connection.template", String, :template dbcfg.declare_config "PostgreSQL.Connection.encoding", String, :encoding +dbcfg.declare_config "PostgreSQL.Connection.collation", String, :collation application_config = {} %w(application.default application).each do |cfgfile| @@ -253,6 +256,13 @@ end if ::Rails.env.to_s == "test" && db_config["test"].nil? $arvados_config["PostgreSQL"]["Connection"]["dbname"] = "arvados_test" end +if ::Rails.env.to_s == "test" + # Use template0 when creating a new database. Avoids + # character-encoding/collation problems. + $arvados_config["PostgreSQL"]["Connection"]["template"] = "template0" + # Some test cases depend on en_US.UTF-8 collation. + $arvados_config["PostgreSQL"]["Connection"]["collation"] = "en_US.UTF-8" +end if $arvados_config["PostgreSQL"]["Connection"]["password"].empty? raise "Database password is empty, PostgreSQL section is: #{$arvados_config["PostgreSQL"]}" @@ -269,13 +279,16 @@ end # For config migration, we've previously populated the PostgreSQL # section of the config from database.yml # -ENV["DATABASE_URL"] = "postgresql://#{$arvados_config["PostgreSQL"]["Connection"]["user"]}:"+ - "#{$arvados_config["PostgreSQL"]["Connection"]["password"]}@"+ - "#{dbhost}/#{$arvados_config["PostgreSQL"]["Connection"]["dbname"]}?"+ +database_url = "postgresql://#{CGI.escape $arvados_config["PostgreSQL"]["Connection"]["user"]}:"+ + "#{CGI.escape $arvados_config["PostgreSQL"]["Connection"]["password"]}@"+ + "#{dbhost}/#{CGI.escape $arvados_config["PostgreSQL"]["Connection"]["dbname"]}?"+ "template=#{$arvados_config["PostgreSQL"]["Connection"]["template"]}&"+ "encoding=#{$arvados_config["PostgreSQL"]["Connection"]["client_encoding"]}&"+ + "collation=#{$arvados_config["PostgreSQL"]["Connection"]["collation"]}&"+ "pool=#{$arvados_config["PostgreSQL"]["ConnectionPool"]}" +ENV["DATABASE_URL"] = database_url + Server::Application.configure do # Copy into the Rails config object. This also turns Hash into # OrderedOptions so that application code can use