@toa.io/pointer 0.4.0-dev.8 → 0.4.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.
- package/package.json +5 -5
- package/source/pointer.js +2 -2
- package/test/pointer.test.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/pointer",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Toa Pointer",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"main": "source/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@toa.io/console": "0.4.0
|
|
27
|
-
"@toa.io/generic": "0.4.0
|
|
28
|
-
"@toa.io/schema": "0.4.0
|
|
29
|
-
"@toa.io/yaml": "0.4.0
|
|
26
|
+
"@toa.io/console": "0.4.0",
|
|
27
|
+
"@toa.io/generic": "0.4.0",
|
|
28
|
+
"@toa.io/schema": "0.4.0",
|
|
29
|
+
"@toa.io/yaml": "0.4.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/source/pointer.js
CHANGED
|
@@ -17,8 +17,8 @@ class Pointer {
|
|
|
17
17
|
* @param {toa.pointer.Options} options
|
|
18
18
|
*/
|
|
19
19
|
constructor (prefix, locator, options) {
|
|
20
|
-
const
|
|
21
|
-
const url =
|
|
20
|
+
const dev = process.env.TOA_DEV === '1'
|
|
21
|
+
const url = dev ? get.local(options.protocol) : get.env(prefix, locator)
|
|
22
22
|
|
|
23
23
|
this.protocol = url.protocol
|
|
24
24
|
this.hostname = url.hostname
|
package/test/pointer.test.js
CHANGED
|
@@ -106,22 +106,22 @@ it('should expose reference', () => {
|
|
|
106
106
|
})
|
|
107
107
|
|
|
108
108
|
it('should use localhost and given protocol on local environment', () => {
|
|
109
|
-
process.env.
|
|
109
|
+
process.env.TOA_DEV = '1'
|
|
110
110
|
|
|
111
111
|
pointer = new Pointer(prefix, locator, options)
|
|
112
112
|
|
|
113
|
-
delete process.env.
|
|
113
|
+
delete process.env.TOA_DEV
|
|
114
114
|
|
|
115
115
|
expect(pointer.hostname).toStrictEqual('localhost')
|
|
116
116
|
expect(pointer.protocol).toStrictEqual(options.protocol)
|
|
117
117
|
})
|
|
118
118
|
|
|
119
119
|
it('should use default protocol and credentials on local environment', () => {
|
|
120
|
-
process.env.
|
|
120
|
+
process.env.TOA_DEV = '1'
|
|
121
121
|
|
|
122
122
|
pointer = new Pointer(prefix, locator, options)
|
|
123
123
|
|
|
124
|
-
delete process.env.
|
|
124
|
+
delete process.env.TOA_DEV
|
|
125
125
|
|
|
126
126
|
expect(pointer.reference).toStrictEqual(`${options.protocol}//developer:secret@localhost`)
|
|
127
127
|
expect(pointer.label).toStrictEqual(`${options.protocol}//developer@localhost`)
|