Skip to content

Commit 8685827

Browse files
authored
Merge pull request #13 from platformsh/dedicated
Dedicated not enterprise.
2 parents 99ba74f + 13f505c commit 8685827

File tree

5 files changed

+98
-21
lines changed

5 files changed

+98
-21
lines changed

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Changelog
2+
3+
## [2.3.1] - 2019-11-04
4+
5+
### Added
6+
7+
* `CHANGELOG` added.
8+
* `onDedicated` method that determines if the current environment is a Platform.sh Dedicated environment. Replaces deprecated `onEnterprise` method.
9+
10+
### Changed
11+
12+
* Deprecates `onEnterprise` method - which is for now made to wrap around the added `onDedicated` method. `onEnterprise` **will be removed** in a future release, so update your projects to use `onDedicated` instead as soon as possible.
13+
14+
## [2.3.0] - 2019-09-19
15+
16+
### Added
17+
18+
* `getPrimaryRoute` method for accessing routes marked "primary" in `routes.yaml`.
19+
* `getUpstreamRoutes` method returns an object map that includes only those routes that point to a valid upstream.
20+
21+
## [2.2.5] - 2019-06-04
22+
23+
### Added
24+
25+
* Credential formatter `puppeteerFormatter` that returns Puppeteer connection string for using [Headless Chrome](https://docs.platform.sh/configuration/services/headless-chrome.html) on Platform.sh.
26+
27+
## [2.2.1] - 2019-04-30
28+
29+
### Removed
30+
31+
* Removes the strict guard in place on the `variables` method.
32+
33+
## [2.2.0] - 2019-04-24
34+
35+
### Changed
36+
37+
* Checks for valid environments were relaxed to unbreak use during local development.
38+
39+
## [2.1.0] - 2019-03-22
40+
41+
### Added
42+
43+
* `hasRelationship` method to verify relationship has been defined before attempting to access credentials for it.
44+
45+
### Changed
46+
47+
* BSD-2-Clause to MIT license.
48+
49+
## [2.0.3] - 2019-03-06
50+
51+
### Added
52+
53+
* CircleCI deploy hook added to publish to npm.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,17 @@ config.inBuild();
6161

6262
config.inRuntime();
6363

64-
config.onEnterprise();
64+
config.onDedicated();
6565

6666
config.onProduction();
6767
```
6868

69+
> **Note:**
70+
>
71+
> Platform.sh will no longer refer to its [99.99% uptime SLA product](https://platform.sh/solutions/) as "Enterprise", but rather as "Dedicated". Configuration Reader libraries have in turn been updated to include an `onDedicated` method to replace `onEnterprise`. For now `onEnterprise` remains available. It now calls the new method and no breaking changes have been introduced.
72+
>
73+
> It is recommended that you update your projects to use `onDedicated` as soon as possible, as `onEnterprise` will be removed in a future version of this library.
74+
6975
### Read environment variables
7076

7177
The following magic properties return the corresponding environment variable value. See the [Platform.sh documentation](https://docs.platform.sh/development/variables.html) for a description of each.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "platformsh-config",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "Helper for running nodejs applications on Platform.sh",
55
"main": "lib/platformsh.js",
66
"keywords": [

src/platformsh.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,31 @@ class Config {
148148
}
149149

150150
/**
151-
* Determines if the current environment is a Platform.sh Enterprise environment.
151+
* Determines if the current environment is a Platform.sh Dedicated environment.
152+
*
153+
* @deprecated
154+
*
155+
* The Platform.sh "Enterprise" will soon be referred to exclusively as
156+
* "Dedicated". the `onEnterprise` method remains available for now, but it
157+
* will be removed in a future version of this library.
158+
*
159+
* It is recommended that you update your projects to use `onDedicated` as
160+
* soon as possible.
152161
*
153162
* @return {boolean}
154-
* True on an Enterprise environment, False otherwise.
163+
* True on an Dedicated environment, False otherwise.
155164
*/
156165
onEnterprise() {
166+
return this.onDedicated();
167+
}
168+
169+
/**
170+
* Determines if the current environment is a Platform.sh Dedicated environment.
171+
*
172+
* @return {boolean}
173+
* True on an Dedicated environment, False otherwise.
174+
*/
175+
onDedicated() {
157176
return this.isValidPlatform() && this._getValue('MODE') === 'enterprise';
158177
}
159178

@@ -613,4 +632,3 @@ module.exports = {
613632
if (process.env.NODE_ENV === 'test') {
614633
module.exports.Config = Config;
615634
}
616-

test/tests.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,41 +92,41 @@ describe("Config tests", () => {
9292
});
9393
});
9494

95-
describe("onEnterprise() tests", () => {
95+
describe("onDedicated() tests", () => {
9696

97-
it('Returns true in enterprise environment', () => {
98-
let mockEnvironmentEnterprise = deepClone(mockEnvironmentRuntime);
99-
mockEnvironmentEnterprise['PLATFORM_MODE'] = 'enterprise';
97+
it('Returns true in Dedicated environment', () => {
98+
let mockEnvironmentDedicated = deepClone(mockEnvironmentRuntime);
99+
mockEnvironmentDedicated['PLATFORM_MODE'] = 'enterprise';
100100

101-
let c = new psh.Config(mockEnvironmentEnterprise);
101+
let c = new psh.Config(mockEnvironmentDedicated);
102102

103-
assert.ok(c.onEnterprise());
103+
assert.ok(c.onDedicated());
104104
});
105105

106106
it('Returns false in standard environment', () => {
107107
let c = new psh.Config(mockEnvironmentRuntime);
108108

109-
assert.ok(!c.onEnterprise());
109+
assert.ok(!c.onDedicated());
110110
});
111111
});
112112

113113
describe("onProduction() tests", () => {
114114

115-
it('Returns true on enterprise production', () => {
116-
let mockEnvironmentEnterprise = deepClone(mockEnvironmentRuntime);
117-
mockEnvironmentEnterprise['PLATFORM_MODE'] = 'enterprise';
118-
mockEnvironmentEnterprise['PLATFORM_BRANCH'] = 'production';
115+
it('Returns true on Dedicated production', () => {
116+
let mockEnvironmentDedicated = deepClone(mockEnvironmentRuntime);
117+
mockEnvironmentDedicated['PLATFORM_MODE'] = 'enterprise';
118+
mockEnvironmentDedicated['PLATFORM_BRANCH'] = 'production';
119119

120-
let c = new psh.Config(mockEnvironmentEnterprise);
120+
let c = new psh.Config(mockEnvironmentDedicated);
121121

122122
assert.ok(c.onProduction());
123123
});
124124

125-
it('Returns false on enterprise staging', () => {
126-
let mockEnvironmentEnterprise = deepClone(mockEnvironmentRuntime);
127-
mockEnvironmentEnterprise['PLATFORM_MODE'] = 'enterprise';
125+
it('Returns false on Dedicated staging', () => {
126+
let mockEnvironmentDedicated = deepClone(mockEnvironmentRuntime);
127+
mockEnvironmentDedicated['PLATFORM_MODE'] = 'enterprise';
128128

129-
let c = new psh.Config(mockEnvironmentEnterprise);
129+
let c = new psh.Config(mockEnvironmentDedicated);
130130

131131
assert.ok(!c.onProduction());
132132
});

0 commit comments

Comments
 (0)