@ovh-ux/manager-dev-server-config 5.0.0 → 6.0.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 CHANGED
@@ -1,3 +1,37 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [6.0.0](https://github.com/ovh/manager/compare/@ovh-ux/manager-dev-server-config@5.0.1...@ovh-ux/manager-dev-server-config@6.0.0) (2023-09-07)
7
+
8
+
9
+ ### Build System
10
+
11
+ * bump nodejs to v18 and webpack to v5 ([6270204](https://github.com/ovh/manager/commit/6270204e59bbfb87ec000c5853be08027affbb69))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * bump webpack from v4 to v5
17
+
18
+ Signed-off-by: Florian Renaut <florian.renaut@corp.ovh.com>
19
+ Co-authored-by: Jisay <jean-christophe.alleman@corp.ovh.com>
20
+ Co-authored-by: Anoop N <anoop.n@ovhcloud.com>
21
+
22
+
23
+
24
+
25
+
26
+ ## [5.0.1](https://github.com/ovh/manager/compare/@ovh-ux/manager-dev-server-config@5.0.0...@ovh-ux/manager-dev-server-config@5.0.1) (2022-10-19)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **dev-server-config:** allow to define custom host ([b59706d](https://github.com/ovh/manager/commit/b59706d20a3cf221ada6ab7779d14268dac84e9b))
32
+
33
+
34
+
1
35
  # [5.0.0](https://github.com/ovh/manager/compare/@ovh-ux/manager-dev-server-config@4.0.0...@ovh-ux/manager-dev-server-config@5.0.0) (2022-09-12)
2
36
 
3
37
 
@@ -91,6 +125,3 @@
91
125
  * **dev-server-config:** add manager-dev-server-config package
92
126
 
93
127
  Signed-off-by: Cyrille Bourgois <cyrille.bourgois@corp.ovh.com>
94
-
95
-
96
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovh-ux/manager-dev-server-config",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "Provide OVHcloud Manager dev server config",
5
5
  "keywords": [
6
6
  "config",
@@ -21,7 +21,7 @@
21
21
  "request": "^2.88.0"
22
22
  },
23
23
  "engines": {
24
- "node": "^16",
24
+ "node": "^18",
25
25
  "yarn": ">=1.21.1"
26
26
  }
27
- }
27
+ }
@@ -4,8 +4,8 @@ const TARGET = {
4
4
  us: 'https://us.ovhcloud.com',
5
5
  };
6
6
 
7
- module.exports = (region) => ({
8
- target: TARGET[region.toLowerCase()],
7
+ module.exports = (region, config = {}) => ({
8
+ target: config.host ? `https://${config.host}` : TARGET[region.toLowerCase()],
9
9
  context: ['/engine', '/auth'],
10
10
  changeOrigin: true,
11
11
  logLevel: 'silent',
package/src/sso/index.js CHANGED
@@ -3,31 +3,30 @@ const base64url = require('base64url');
3
3
  const cookie = require('cookie');
4
4
  const proxy = require('request');
5
5
 
6
- const CONFIG = {
6
+ const REGION_CONFIG = {
7
7
  ssoAuth: {
8
- eu: {
9
- host: 'www.ovh.com',
10
- baseUrl: 'https://www.ovh.com/cgi-bin/crosslogin.cgi',
11
- devLoginUrl: 'https://www.ovh.com/auth/requestDevLogin/',
12
- },
13
- ca: {
14
- host: 'ca.ovh.com',
15
- devLoginUrl: 'https://ca.ovh.com/auth/requestDevLogin/',
16
- baseUrl: 'https://ca.ovh.com/cgi-bin/crosslogin.cgi',
17
- },
18
- us: {
19
- host: 'us.ovhcloud.com',
20
- devLoginUrl: 'https://us.ovhcloud.com/auth/requestDevLogin/',
21
- baseUrl: 'https://us.ovhcloud.com/cgi-bin/crosslogin.cgi',
22
- },
8
+ eu: 'www.ovh.com',
9
+ ca: 'ca.ovh.com',
10
+ us: 'us.ovhcloud.com',
23
11
  },
24
12
  };
25
13
 
14
+ const buildConfig = (host) => ({
15
+ host,
16
+ devLoginUrl: `https://${host}/auth/requestDevLogin/`,
17
+ baseUrl: `https://${host}/cgi-bin/crosslogin.cgi`,
18
+ authURL: `https://${host}/auth`,
19
+ });
20
+
26
21
  module.exports = class Sso {
27
22
  config;
28
23
 
29
- constructor(region) {
30
- this.config = CONFIG.ssoAuth[region.toLowerCase()];
24
+ constructor(region, config = {}) {
25
+ if (config.host) {
26
+ this.config = buildConfig(config.host);
27
+ } else {
28
+ this.config = buildConfig(REGION_CONFIG.ssoAuth[region.toLowerCase()]);
29
+ }
31
30
  }
32
31
 
33
32
  login(req, res) {
@@ -114,6 +113,11 @@ module.exports = class Sso {
114
113
  );
115
114
  });
116
115
 
116
+ if (redirectionUrl.startsWith('/')) {
117
+ res.redirect(`${this.config.authURL}${redirectionUrl}`);
118
+ return;
119
+ }
120
+
117
121
  res.redirect(redirectionUrl);
118
122
  }
119
123