plek 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/plek.rb +14 -3
- data/lib/plek/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db58b6a4a924d4c06eed2f4aa05251a733b71ccf
|
4
|
+
data.tar.gz: 4a59305d33e96a082ecce8e9908aadacc8bc21f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7341e606a4629f61f87ccf1cb2087f2b70a10bf3513cd301e6e867313eab3dc52ca3bfc6a2e69a900352f66f707634f8ebc33866e70d50ecba071f5d5f81d3
|
7
|
+
data.tar.gz: afc6924a5f847f6268f16561caa194fbe491509d3f899b38bc36d022dd5f6c62e6a0c1f1920432b2d8f483d04646ef4a9dbbb02cd217471a5bcf0299233c3ea0
|
data/lib/plek.rb
CHANGED
@@ -22,7 +22,7 @@ class Plek
|
|
22
22
|
# Domains to return http URLs for.
|
23
23
|
HTTP_DOMAINS = [ DEV_DOMAIN ]
|
24
24
|
|
25
|
-
attr_accessor :parent_domain
|
25
|
+
attr_accessor :parent_domain, :external_domain
|
26
26
|
|
27
27
|
# Construct a new Plek instance.
|
28
28
|
#
|
@@ -31,8 +31,10 @@ class Plek
|
|
31
31
|
#
|
32
32
|
# In development mode, this falls back to {DEV_DOMAIN} if the environment
|
33
33
|
# variable is unset.
|
34
|
-
def initialize(domain_to_use = nil)
|
34
|
+
def initialize(domain_to_use = nil, external_domain = nil)
|
35
35
|
self.parent_domain = domain_to_use || env_var_or_dev_fallback("GOVUK_APP_DOMAIN", DEV_DOMAIN)
|
36
|
+
self.external_domain = external_domain ||
|
37
|
+
env_var_or_dev_fallback("GOVUK_APP_DOMAIN_EXTERNAL", DEV_DOMAIN)
|
36
38
|
end
|
37
39
|
|
38
40
|
# Find the base URL for a service/application. This constructs the URL from
|
@@ -61,7 +63,7 @@ class Plek
|
|
61
63
|
return service_uri
|
62
64
|
end
|
63
65
|
|
64
|
-
host = "#{name}.#{parent_domain}"
|
66
|
+
host = "#{name}.#{options[:external] ? external_domain : parent_domain}"
|
65
67
|
|
66
68
|
if host_prefix = ENV['PLEK_HOSTNAME_PREFIX']
|
67
69
|
host = "#{host_prefix}#{host}"
|
@@ -76,6 +78,15 @@ class Plek
|
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
81
|
+
# Find the external URL for a service/application.
|
82
|
+
#
|
83
|
+
# @param service [String] the name of the service to lookup. This should be
|
84
|
+
# the hostname of the service.
|
85
|
+
# @param options [Hash] see the documentation for find.
|
86
|
+
def external_url_for(service, options = {})
|
87
|
+
find(service, options.merge(external: true))
|
88
|
+
end
|
89
|
+
|
79
90
|
# Find the base URL for a service/application, and parse as a URI object.
|
80
91
|
# This wraps #find and returns the parsed result.
|
81
92
|
#
|
data/lib/plek/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig R Webster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|