plek 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -6
- data/lib/plek.rb +8 -4
- 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: 42c206eb83b9c41dc31647b2d72dc48efaaff889
|
4
|
+
data.tar.gz: 5c8371aed356ad734c2ce789e488e3a2c473d794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dee761715a61b7ab2cd78b874b3ca0e22810893b31cdd9273b10ff629fdf5451572e409ed5015ca3685259197e74a2c3a2c14d83ebf942a84352c850b233ab26
|
7
|
+
data.tar.gz: 4049d5ad0a3f9b58a14109e0f47c677c80314b385b34ad1e78e3dfa11934c4d82012db7de2d9e9918d819274642ca4367411649a426a7113bc8888e3869e6cc7
|
data/README.md
CHANGED
@@ -3,14 +3,28 @@
|
|
3
3
|
"Plek" is Afrikaans. It means "Location". Plek is used to generate the correct
|
4
4
|
base URLs for internal GOV.UK services, eg:
|
5
5
|
|
6
|
-
```ruby
|
7
|
-
Plek.find('frontend')
|
8
6
|
```
|
7
|
+
# on a dev machine
|
8
|
+
> Plek.find('frontend')
|
9
|
+
=> "http://frontend.dev.gov.uk"
|
10
|
+
# on a production machine
|
11
|
+
> Plek.find('frontend')
|
12
|
+
=> "https://frontend.publishing.service.gov.uk"
|
13
|
+
```
|
14
|
+
|
15
|
+
This means we can use this in our code and let our environment configuration
|
16
|
+
figure out the correct hosts for us at runtime.
|
17
|
+
|
18
|
+
In an environment where we have internal hostnames and external ones an option
|
19
|
+
of `external` can be provided to determine whether an internal or external
|
20
|
+
host is returned.
|
9
21
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
22
|
+
```
|
23
|
+
> Plek.find('frontend')
|
24
|
+
=> "https://frontend.integration.govuk-internal.digital"
|
25
|
+
> Plek.find('frontend', external: true)
|
26
|
+
=> "https://frontend.integration.publishing.service.gov.uk"
|
27
|
+
```
|
14
28
|
|
15
29
|
## Technical documentation
|
16
30
|
|
data/lib/plek.rb
CHANGED
@@ -26,15 +26,19 @@ class Plek
|
|
26
26
|
|
27
27
|
# Construct a new Plek instance.
|
28
28
|
#
|
29
|
-
# @param domain_to_use [String] Optionally override the parent domain
|
30
|
-
# If unspecified, this uses the +GOVUK_APP_DOMAIN+ environment
|
29
|
+
# @param domain_to_use [String, nil] Optionally override the parent domain
|
30
|
+
# to use. If unspecified, this uses the +GOVUK_APP_DOMAIN+ environment
|
31
|
+
# variable.
|
31
32
|
#
|
32
33
|
# In development mode, this falls back to {DEV_DOMAIN} if the environment
|
33
34
|
# variable is unset.
|
35
|
+
# @param external_domain [String, nil] Optionally override the external
|
36
|
+
# domain to use. If unspecified it will fall back to using
|
37
|
+
# +GOVUK_APP_DOMAIN_EXTERNAL+ and if that is unavailable the parent domain
|
38
|
+
# will be used
|
34
39
|
def initialize(domain_to_use = nil, external_domain = nil)
|
35
40
|
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)
|
41
|
+
self.external_domain = external_domain || ENV["GOVUK_APP_DOMAIN_EXTERNAL"] || parent_domain
|
38
42
|
end
|
39
43
|
|
40
44
|
# Find the base URL for a service/application. This constructs the URL from
|
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.1.
|
4
|
+
version: 2.1.1
|
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: 2018-
|
11
|
+
date: 2018-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|