diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-04 04:54:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-04 04:54:33 +0300 |
commit | 635ebac606d77eae03ce2e2a8f0a814ad4c79177 (patch) | |
tree | 8f3047074880166e53edb987df8ba4295d374c3d /config | |
parent | ac7af45d8987422c2a529d3d87eae6d9bd608e12 (diff) | |
parent | 704922c855a9741b5495db56ac266788a9c25c33 (diff) |
Merge branch 'master' into mwessel/gitlab-ce-configure-protection
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 5 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 2 | ||||
-rw-r--r-- | config/initializers/7_omniauth.rb | 2 | ||||
-rw-r--r-- | config/initializers/acts_as_taggable_on_patch.rb | 35 | ||||
-rw-r--r-- | config/initializers/carrierwave.rb | 28 | ||||
-rw-r--r-- | config/initializers/doorkeeper.rb | 4 | ||||
-rw-r--r-- | config/initializers/gitlab_shell_secret_token.rb | 2 | ||||
-rw-r--r-- | config/routes.rb | 68 |
8 files changed, 80 insertions, 66 deletions
diff --git a/config/application.rb b/config/application.rb index a7d371c78ea..24ba219cf3a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -70,7 +70,10 @@ module Gitlab config.middleware.use Rack::Cors do allow do origins '*' - resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete] + resource '/api/*', + headers: :any, + methods: [:get, :post, :options, :put, :delete], + expose: ['Link'] end end diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 2c8441ece08..24f39f5b3c1 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -149,7 +149,7 @@ Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_s Settings['backup'] ||= Settingslogic.new({}) Settings.backup['keep_time'] ||= 0 Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) -Settings.backup['upload'] ||= Settingslogic.new({'remote_directory' => nil, 'connection' => nil}) +Settings.backup['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'connection' => nil }) # Convert upload connection settings to use symbol keys, to make Fog happy if Settings.backup['upload']['connection'] Settings.backup['upload']['connection'] = Hash[Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }] diff --git a/config/initializers/7_omniauth.rb b/config/initializers/7_omniauth.rb index 18759f0cfb0..8f6c5673103 100644 --- a/config/initializers/7_omniauth.rb +++ b/config/initializers/7_omniauth.rb @@ -9,4 +9,4 @@ if Gitlab::LDAP::Config.enabled? server = Gitlab.config.ldap.servers.values.first alias_method server['provider_name'], :ldap end -end
\ No newline at end of file +end diff --git a/config/initializers/acts_as_taggable_on_patch.rb b/config/initializers/acts_as_taggable_on_patch.rb index baa77fde392..0d535cb5cac 100644 --- a/config/initializers/acts_as_taggable_on_patch.rb +++ b/config/initializers/acts_as_taggable_on_patch.rb @@ -42,11 +42,12 @@ module ActsAsTaggableOn::Taggable elsif options.delete(:any) # get tags, drop out if nothing returned (we need at least one) - tags = if options.delete(:wild) - ActsAsTaggableOn::Tag.named_like_any(tag_list) - else - ActsAsTaggableOn::Tag.named_any(tag_list) - end + tags = + if options.delete(:wild) + ActsAsTaggableOn::Tag.named_like_any(tag_list) + else + ActsAsTaggableOn::Tag.named_any(tag_list) + end return empty_result unless tags.length > 0 @@ -68,12 +69,12 @@ module ActsAsTaggableOn::Taggable select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one? if owned_by - tagging_join << " AND " + - sanitize_sql([ - "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", - owned_by.id, - owned_by.class.base_class.to_s - ]) + tagging_join << " AND " + + sanitize_sql([ + "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", + owned_by.id, + owned_by.class.base_class.to_s + ]) end joins << tagging_join @@ -92,12 +93,12 @@ module ActsAsTaggableOn::Taggable tagging_join << " AND " + sanitize_sql(["#{taggings_alias}.context = ?", context.to_s]) if context if owned_by - tagging_join << " AND " + - sanitize_sql([ - "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", - owned_by.id, - owned_by.class.base_class.to_s - ]) + tagging_join << " AND " + + sanitize_sql([ + "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", + owned_by.id, + owned_by.class.base_class.to_s + ]) end joins << tagging_join diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index d0065b63e54..bfb8656df55 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -12,22 +12,30 @@ if File.exists?(aws_file) aws_secret_access_key: AWS_CONFIG['secret_access_key'], # required region: AWS_CONFIG['region'], # optional, defaults to 'us-east-1' } - config.fog_directory = AWS_CONFIG['bucket'] # required - config.fog_public = false # optional, defaults to true - config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} - config.fog_authenticated_url_expiration = 1 << 29 # optional time (in seconds) that authenticated urls will be valid. - # when fog_public is false and provider is AWS or Google, defaults to 600 + + # required + config.fog_directory = AWS_CONFIG['bucket'] + + # optional, defaults to true + config.fog_public = false + + # optional, defaults to {} + config.fog_attributes = { 'Cache-Control'=>'max-age=315576000' } + + # optional time (in seconds) that authenticated urls will be valid. + # when fog_public is false and provider is AWS or Google, defaults to 600 + config.fog_authenticated_url_expiration = 1 << 29 end # Mocking Fog requests, based on: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Test-Fog-based-uploaders if Rails.env.test? Fog.mock! connection = ::Fog::Storage.new( - :aws_access_key_id => AWS_CONFIG['access_key_id'], - :aws_secret_access_key => AWS_CONFIG['secret_access_key'], - :provider => 'AWS', - :region => AWS_CONFIG['region'] + aws_access_key_id: AWS_CONFIG['access_key_id'], + aws_secret_access_key: AWS_CONFIG['secret_access_key'], + provider: 'AWS', + region: AWS_CONFIG['region'] ) - connection.directories.create(:key => AWS_CONFIG['bucket']) + connection.directories.create(key: AWS_CONFIG['bucket']) end end diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 4819ab273dc..e9b843e29b4 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -43,10 +43,10 @@ Doorkeeper.configure do force_ssl_in_redirect_uri false # Provide support for an owner to be assigned to each registered application (disabled by default) - # Optional parameter :confirmation => true (default false) if you want to enforce ownership of + # Optional parameter confirmation: true (default false) if you want to enforce ownership of # a registered application # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support - enable_application_owner :confirmation => false + enable_application_owner confirmation: false # Define access token scopes for your provider # For more information go to diff --git a/config/initializers/gitlab_shell_secret_token.rb b/config/initializers/gitlab_shell_secret_token.rb index 8d2b771e535..e7c9f0ba7c2 100644 --- a/config/initializers/gitlab_shell_secret_token.rb +++ b/config/initializers/gitlab_shell_secret_token.rb @@ -16,4 +16,4 @@ end if File.exist?(Gitlab.config.gitlab_shell.path) && !File.exist?(gitlab_shell_symlink) FileUtils.symlink(secret_file, gitlab_shell_symlink) -end
\ No newline at end of file +end diff --git a/config/routes.rb b/config/routes.rb index e122777314a..f0abd876ecd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,9 +3,9 @@ require 'api/api' Gitlab::Application.routes.draw do use_doorkeeper do - controllers :applications => 'oauth/applications', - :authorized_applications => 'oauth/authorized_applications', - :authorizations => 'oauth/authorizations' + controllers applications: 'oauth/applications', + authorized_applications: 'oauth/authorized_applications', + authorizations: 'oauth/authorizations' end # # Search @@ -177,7 +177,7 @@ Gitlab::Application.routes.draw do # # Groups Area # - resources :groups, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do + resources :groups, constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ } do member do get :issues get :merge_requests @@ -215,40 +215,44 @@ Gitlab::Application.routes.draw do scope module: :projects do # Blob routes: - get '/new/:id', to: 'blob#new', constraints: {id: /.+/}, as: 'new_blob' - post '/create/:id', to: 'blob#create', constraints: {id: /.+/}, as: 'create_blob' - get '/edit/:id', to: 'blob#edit', constraints: {id: /.+/}, as: 'edit_blob' - put '/update/:id', to: 'blob#update', constraints: {id: /.+/}, as: 'update_blob' - post '/preview/:id', to: 'blob#preview', constraints: {id: /.+/}, as: 'preview_blob' + get '/new/:id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob' + post '/create/:id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob' + get '/edit/:id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob' + put '/update/:id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob' + post '/preview/:id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob' resources :blob, only: [:show, :destroy], constraints: { id: /.+/, format: false } do get :diff, on: :member end - resources :raw, only: [:show], constraints: {id: /.+/} - resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } + resources :raw, only: [:show], constraints: { id: /.+/ } + resources :tree, only: [:show], constraints: { id: /.+/, format: /(html|js)/ } resource :avatar, only: [:show, :destroy] - resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} - resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + + resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do + get :branches, on: :member + end + + resources :commits, only: [:show], constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ } resources :compare, only: [:index, :create] - resources :blame, only: [:show], constraints: {id: /.+/} - resources :network, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} - resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} do + resources :blame, only: [:show], constraints: { id: /.+/ } + resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } + resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do member do get :commits end end get '/compare/:from...:to' => 'compare#show', :as => 'compare', - :constraints => {from: /.+/, to: /.+/} + :constraints => { from: /.+/, to: /.+/ } - resources :snippets, constraints: {id: /\d+/} do + resources :snippets, constraints: { id: /\d+/ } do member do get 'raw' end end - resources :wikis, only: [:show, :edit, :destroy, :create], constraints: {id: /[a-zA-Z.0-9_\-\/]+/} do + resources :wikis, only: [:show, :edit, :destroy, :create], constraints: { id: /[a-zA-Z.0-9_\-\/]+/ } do collection do get :pages put ':id' => 'wikis#update' @@ -275,7 +279,7 @@ Gitlab::Application.routes.draw do end end - resources :deploy_keys, constraints: {id: /\d+/} do + resources :deploy_keys, constraints: { id: /\d+/ } do member do put :enable put :disable @@ -294,16 +298,14 @@ Gitlab::Application.routes.draw do member do # tree viewer logs get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex } - get 'logs_tree/:path' => 'refs#logs_tree', - as: :logs_file, - constraints: { - id: Gitlab::Regex.git_reference_regex, - path: /.*/ - } + get 'logs_tree/:path' => 'refs#logs_tree', as: :logs_file, constraints: { + id: Gitlab::Regex.git_reference_regex, + path: /.*/ + } end end - resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do + resources :merge_requests, constraints: { id: /\d+/ }, except: [:destroy] do member do get :diffs post :automerge @@ -318,27 +320,27 @@ Gitlab::Application.routes.draw do end end - resources :hooks, only: [:index, :create, :destroy], constraints: {id: /\d+/} do + resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do member do get :test end end resources :team, controller: 'team_members', only: [:index] - resources :milestones, except: [:destroy], constraints: {id: /\d+/} do + resources :milestones, except: [:destroy], constraints: { id: /\d+/ } do member do put :sort_issues put :sort_merge_requests end end - resources :labels, constraints: {id: /\d+/} do + resources :labels, constraints: { id: /\d+/ } do collection do post :generate end end - resources :issues, constraints: {id: /\d+/}, except: [:destroy] do + resources :issues, constraints: { id: /\d+/ }, except: [:destroy] do collection do post :bulk_update end @@ -355,7 +357,7 @@ Gitlab::Application.routes.draw do end end - resources :notes, only: [:index, :create, :destroy, :update], constraints: {id: /\d+/} do + resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do member do delete :delete_attachment end @@ -364,7 +366,7 @@ Gitlab::Application.routes.draw do end end - get ':id' => 'namespaces#show', constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ } root to: 'dashboard#show' end |