unleash-server 3.3.3 → 3.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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/docs/getting-started.md +20 -1
- package/lib/authentication-required.js +2 -1
- package/lib/options.js +1 -0
- package/lib/server-impl.js +24 -15
- package/lib/server-impl.test.js +17 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.4.0
|
|
4
|
+
|
|
5
|
+
- feat: Adds server.create() (#606)
|
|
6
|
+
|
|
7
|
+
## 3.3.6
|
|
8
|
+
|
|
9
|
+
- fix: upgrade unleash-frontend to verson 3.3.5
|
|
10
|
+
|
|
11
|
+
## 3.3.5
|
|
12
|
+
|
|
13
|
+
- fix: upgrade unleash-frontend to verson 3.3.3
|
|
14
|
+
|
|
15
|
+
## 3.3.4
|
|
16
|
+
|
|
17
|
+
- fix: we now support node 14 :hurray
|
|
18
|
+
- fix: upgrade db-migrate-pg to version 1.2.2
|
|
19
|
+
- fix: upgrade unleash-frontend to version 3.3.2
|
|
20
|
+
|
|
3
21
|
## 3.3.3
|
|
4
22
|
|
|
5
23
|
- chore: add a few more community client SDKs
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ Clients written by awesome enthusiasts: :fire:
|
|
|
55
55
|
- [uekoetter.dev/unleash-client-dart](https://pub.dev/packages/unleash) (Dart)
|
|
56
56
|
- [minds/unleash-client-php](https://gitlab.com/minds/unleash-client-php) (PHP)
|
|
57
57
|
- [afontaine/unleash_ex](https://gitlab.com/afontaine/unleash_ex) (Elixir)
|
|
58
|
-
- [mikefrancis/laravel-unleash](https://github.com/mikefrancis/laravel-unleash) (
|
|
58
|
+
- [mikefrancis/laravel-unleash](https://github.com/mikefrancis/laravel-unleash) (Laravel - PHP)
|
|
59
59
|
|
|
60
60
|
### The Client API
|
|
61
61
|
|
package/docs/getting-started.md
CHANGED
|
@@ -59,7 +59,26 @@ Available unleash options include:
|
|
|
59
59
|
- **ui** (object) - Set of UI specific overrides. You may set the following keys: `headerBackground`, `environment`, `slogan`.
|
|
60
60
|
- **getLogger** (function) - Used to register a [custom log provider](#How do I configure the log output).
|
|
61
61
|
- **eventHook** (`function(event, data)`) - If provided, this function will be invoked whenever a feature is mutated. The possible values for `event` are `'feature-created'`, `'feature-updated'`, `'feature-archived'`, `'feature-revived'`. The `data` argument contains information about the mutation. Its fields are `type` (string) - the event type (same as `event`); `createdBy` (string) - the user who performed the mutation; `data` - the contents of the change. The contents in `data` differs based on the event type; For `'feature-archived'` and `'feature-revived'`, the only field will be `name` - the name of the feature. For `'feature-created'` and `'feature-updated'` the data follows a schema defined in the code [here](https://github.com/Unleash/unleash/blob/master/lib/routes/admin-api/feature-schema.js#L38-L59). See an example [here](./guides/feautre-updates-to-slack.md).
|
|
62
|
-
- **baseUriPath** (string) - use to register a base path for all routes on the application. For example
|
|
62
|
+
- **baseUriPath** (string) - use to register a base path for all routes on the application. For example `/my/unleash/base` (note the starting /). Defaults to `/`. Can also be configured through the environment variable `BASE_URI_PATH`.
|
|
63
|
+
|
|
64
|
+
#### Disabling Auto-Start
|
|
65
|
+
|
|
66
|
+
If you're using unleash as part of a larger express app, you can disable the automatic server start by calling `server.create`. It takes the same options as `sevrer.start`, but will not begin listening for connections.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const unleash = require('unleash-server');
|
|
70
|
+
// ... const app = express();
|
|
71
|
+
|
|
72
|
+
unleash
|
|
73
|
+
.create({
|
|
74
|
+
databaseUrl: 'postgres://unleash_user:password@localhost:5432/unleash',
|
|
75
|
+
port: 4242,
|
|
76
|
+
})
|
|
77
|
+
.then(result => {
|
|
78
|
+
app.use(result.app);
|
|
79
|
+
console.log(`Unleash app generated and attached to parent application`);
|
|
80
|
+
});
|
|
81
|
+
```
|
|
63
82
|
|
|
64
83
|
### 3. Docker
|
|
65
84
|
|
package/lib/options.js
CHANGED
package/lib/server-impl.js
CHANGED
|
@@ -53,22 +53,26 @@ async function createApp(options) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const server = app.listen(options.listen, () =>
|
|
57
|
-
logger.info('Unleash has started.', server.address()),
|
|
58
|
-
);
|
|
59
|
-
|
|
60
56
|
return new Promise((resolve, reject) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
const payload = {
|
|
58
|
+
app,
|
|
59
|
+
config,
|
|
60
|
+
stores,
|
|
61
|
+
eventBus,
|
|
62
|
+
stateService,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (options.start) {
|
|
66
|
+
const server = app.listen(options.listen, () =>
|
|
67
|
+
logger.info('Unleash has started.', server.address()),
|
|
68
|
+
);
|
|
69
|
+
server.on('listening', () => {
|
|
70
|
+
resolve({ ...payload, server });
|
|
71
|
+
});
|
|
72
|
+
server.on('error', reject);
|
|
73
|
+
} else {
|
|
74
|
+
resolve({ ...payload });
|
|
75
|
+
}
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -90,8 +94,13 @@ async function start(opts) {
|
|
|
90
94
|
return createApp(options);
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
async function create(opts) {
|
|
98
|
+
return start({ ...opts, start: false });
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
module.exports = {
|
|
94
102
|
start,
|
|
103
|
+
create,
|
|
95
104
|
User,
|
|
96
105
|
AuthenticationRequired,
|
|
97
106
|
permissions,
|
package/lib/server-impl.test.js
CHANGED
|
@@ -82,3 +82,20 @@ test('should call eventHook', async t => {
|
|
|
82
82
|
eventStore.emit('feature-created', {});
|
|
83
83
|
t.true(called === 1);
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
test('should auto-create server on start()', async t => {
|
|
87
|
+
const { server } = await serverImpl.start({
|
|
88
|
+
port: 0,
|
|
89
|
+
getLogger,
|
|
90
|
+
start: true,
|
|
91
|
+
});
|
|
92
|
+
t.false(typeof server === 'undefined');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('should not create a server using create()', async t => {
|
|
96
|
+
const { server } = await serverImpl.create({
|
|
97
|
+
port: 0,
|
|
98
|
+
getLogger,
|
|
99
|
+
});
|
|
100
|
+
t.true(typeof server === 'undefined');
|
|
101
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unleash-server",
|
|
3
3
|
"description": "Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unleash",
|
|
7
7
|
"feature toggle",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/unleash/unleash/issues"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": ">=12
|
|
27
|
+
"node": ">=12"
|
|
28
28
|
},
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"main": "./lib/server-impl.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"cookie-parser": "^1.4.4",
|
|
69
69
|
"cookie-session": "^2.0.0-beta.3",
|
|
70
70
|
"db-migrate": "^0.11.10",
|
|
71
|
-
"db-migrate-pg": "^1.2.
|
|
71
|
+
"db-migrate-pg": "^1.2.2",
|
|
72
72
|
"db-migrate-shared": "^1.2.0",
|
|
73
73
|
"deep-diff": "^1.0.2",
|
|
74
74
|
"deepmerge": "^4.2.2",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"prom-client": "^12.0.0",
|
|
88
88
|
"response-time": "^2.3.2",
|
|
89
89
|
"serve-favicon": "^2.5.0",
|
|
90
|
-
"unleash-frontend": "3.3.
|
|
90
|
+
"unleash-frontend": "3.3.5",
|
|
91
91
|
"yargs": "^15.1.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|