Commit 7c088a88 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'sh-make-geo-default-schema-match-config' into 'master'

Use the current node configuration to populate suggested new URL for Geo node

Closes #1416

See merge request !2038
parents fbd6831d 1558d17f
......@@ -5,10 +5,10 @@ class GeoNode < ActiveRecord::Base
belongs_to :oauth_application, class_name: 'Doorkeeper::Application', dependent: :destroy
belongs_to :system_hook, dependent: :destroy
default_values schema: 'http',
default_values schema: lambda { Gitlab.config.gitlab.protocol },
host: lambda { Gitlab.config.gitlab.host },
port: 80,
relative_url_root: '',
port: lambda { Gitlab.config.gitlab.port },
relative_url_root: lambda { Gitlab.config.gitlab.relative_url_root },
primary: false
accepts_nested_attributes_for :geo_node_key, :system_hook
......
---
title: Use the current node configuration to populate suggested new URL for Geo node
merge_request:
author:
......@@ -162,6 +162,15 @@ describe GeoNode, type: :model do
expected_url = 'https://localhost:3000/gitlab'
expect(new_node.url).to eq(expected_url)
end
it 'defaults to existing HTTPS and relative URL if present' do
stub_config_setting(port: 443)
stub_config_setting(protocol: 'https')
stub_config_setting(relative_url_root: '/gitlab')
node = GeoNode.new
expect(node.url).to eq('https://localhost/gitlab')
end
end
describe '#url=' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment