Commit fb8d1c5e authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

refactor: proxy conf files

parent 44ee820b
......@@ -11,17 +11,15 @@
"serve": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve --port 4200",
"start": "npm run prepare && npm run generate-models && npm run serve",
"start:no-watch": "npm run prepare && npm run generate-models && npm run serve -- --watch=false",
"start:local": "npm run prepare && npm run generate-models && npm run serve -- --proxy-config proxy.conf.local.js",
"start:local:no-watch": "npm run prepare && npm run generate-models && npm run serve -- --proxy-config proxy.conf.local.js --watch=false",
"start:remote": "npm run prepare && npm run generate-models && npm run serve -- --host 0.0.0.0 --port 4200 --disable-host-check",
"start:remote:no-watch": "npm run prepare && npm run generate-models && npm run serve -- --host 0.0.0.0 --port 4200 --disable-host-check --watch=false",
"start:dlcmtest": "npm run prepare && npm run generate-models && npm run serve -- -c dlcmtest-local",
"start:dlcmtest:no-watch": "npm run start:dlcmtest -- --watch=false",
"start:noapigenerate": "npm run prepare && npm run serve",
"start:nodocker": "npm run prepare && npm run generate-models && npm run serve -- -c no-docker",
"start:nodocker:no-watch": "npm run prepare && npm run generate-models && npm run serve -- -c no-docker --watch=false",
"start:standalone": "npm run prepare && npm run generate-models && npm run serve -- -c standalone",
"start:standalone:no-watch": "npm run prepare && npm run generate-models && npm run serve -- -c standalone --watch=false",
"start:dlcmtest": "npm run prepare && npm run generate-models && npm run serve -- -c dlcmtest-local",
"start:dlcmtest:no-watch": "npm run start:dlcmtest -- --watch=false",
"start:noapigenerate": "npm run prepare && npm run serve",
"build": "npm run prepare && ng build --aot=true --prod=true --source-map=false",
"test": "npm run prepare && ng test --no-progress --code-coverage",
"test:ci": "npm run prepare && ng test --code-coverage --watch=false --no-progress --browsers=ChromeNoSandboxHeadless",
......@@ -31,7 +29,7 @@
"prepare": "npm run generate-version && npm run environment-local && npm run proxy-conf-local",
"environment-local": "(cp -n src/assets/configurations/environment.local.ts-to-copy.txt src/environments/environment.local.ts || echo environment.local.ts already exists)",
"cypress-environment-local": "(cp -n src/assets/configurations/cypress-environment.local.ts-to-copy.txt cypress/integration/environments/cypress-environment.local.ts || echo cypress-environment.local.ts already exists)",
"proxy-conf-local": "(cp -n proxy.conf.js proxy.conf.local.js || echo proxy.conf.local.js already exists)",
"proxy-conf-local": "(cp -n src/assets/configurations/proxy.conf.local.js-to-copy.txt proxy.conf.local.js || echo proxy.conf.local.js already exists)",
"clean": "(rm -rf node_modules || echo node_modules directory is absent)",
"lint": "ng lint",
"lint:ci": "ng lint",
......@@ -48,7 +46,7 @@
"build:sourcemaps-prod": "npm run build:sourcemaps -- --prod",
"build:sourcemaps-prod-local": "npm run build:sourcemaps -- -c production-local",
"serve:prod": "cd dist/DLCM-Frontend && ws --spa index.html --rewrite \"/api/rss -> https://www.unige.ch/feed/rss\" -p 4200",
"simulate-prod-local": "rm -fr dist && cd ../Solidify-Frontend/ && npm run build-dlcm:nowatch && cd ../DLCM-Portal/ && npm run build:sourcemaps-prod-local && npm run serve:prod",
"simulate-prod-local": "rm -fr dist && cd ../Solidify-Frontend/ && npm run build && cp -fr dist/solidify-frontend ../AoU-Portal/node_modules && cd ../DLCM-Portal/ && npm run build:sourcemaps-prod-local && npm run serve:prod",
"refresh-ngsw-config": "ngsw-config dist/DLCM-Frontend ngsw-config.json",
"build-solidify": "rm -rf ./node_modules/Solidify-Frontend && cd ../Solidify-Frontend && npm run build && rm -fr ../AoU-Portal/node_modules/solidify-frontend && cp -fr dist/solidify-frontend ../DLCM-Portal/node_modules"
},
......
const proxyConfLocal = require("./proxy.conf.local.js")
const proxyConfVariable = require("./proxy.conf.variable.js")
module.exports = {
"/api/rss": {
"target": "https://www.unige.ch/feed",
"logLevel": "info",
"secure": "false",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
},
"/api/short-doi": {
"target": "http://shortdoi.org",
"pathRewrite": {
"^/api/short-doi": ""
},
"changeOrigin": true,
},
...proxyConfVariable.rss,
...proxyConfVariable.shortDoi,
...proxyConfLocal.obj,
}
const proxyConfLocal = require("./proxy.conf.local.js")
const proxyConfVariable = require("./proxy.conf.variable.js")
module.exports = {
"/api/rss": {
"target": "https://www.unige.ch/feed",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
},
"/api/short-doi": {
"target": "http://shortdoi.org",
"pathRewrite": {
"^/api/short-doi": ""
},
"changeOrigin": true,
},
"/dlcm/oauth": {
"target": "http://localhost:16110/dlcm/oauth",
"pathRewrite": {
"^/dlcm/oauth": ""
},
},
"/dlcm/shiblogin": {
"target": "http://localhost:16110",
"onProxyReq": (proxyReq, req, res) => {
proxyReq.setHeader('mail', 'Marty.McFly@unige.ch');
proxyReq.setHeader('uniqueid', '999999@unige.ch');
proxyReq.setHeader('givenname', 'Marty');
proxyReq.setHeader('surname', 'McFly');
proxyReq.setHeader('homeorganization', 'unige.ch');
proxyReq.setHeader('preferredlanguage', 'fr-ch');
},
"onProxyRes": (proxyRes, req, res) => {
proxyRes.headers['Access-Control-Allow-Origin'] = 'http://localhost:4200';
}
},
...proxyConfVariable.rss,
...proxyConfVariable.shortDoi,
...proxyConfVariable.oauth(16110),
...proxyConfVariable.shiblogin(16110),
...proxyConfLocal.obj,
}
const proxyConfLocal = require("./proxy.conf.local.js")
const proxyConfVariable = require("./proxy.conf.variable.js")
module.exports = {
"/api/rss": {
"target": "https://www.unige.ch/feed",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
},
"/api/short-doi": {
"target": "http://shortdoi.org",
"pathRewrite": {
"^/api/short-doi": ""
},
"changeOrigin": true,
},
"/dlcm/oauth": {
"target": "http://localhost:16100/dlcm/oauth",
"pathRewrite": {
"^/dlcm/oauth": ""
},
},
"/dlcm/shiblogin": {
"target": "http://localhost:16100",
"onProxyReq": (proxyReq, req, res) => {
proxyReq.setHeader('mail', 'Marty.McFly@unige.ch');
proxyReq.setHeader('uniqueid', '999999@unige.ch');
proxyReq.setHeader('givenname', 'Marty');
proxyReq.setHeader('surname', 'McFly');
proxyReq.setHeader('homeorganization', 'unige.ch');
proxyReq.setHeader('preferredlanguage', 'fr-ch');
},
"onProxyRes": (proxyRes, req, res) => {
proxyRes.headers['Access-Control-Allow-Origin'] = 'http://localhost:4200';
}
}
...proxyConfVariable.rss,
...proxyConfVariable.shortDoi,
...proxyConfVariable.oauth(16100),
...proxyConfVariable.shiblogin(16100),
...proxyConfLocal.obj,
}
const proxyConfLocal = require("./proxy.conf.local.js")
const proxyConfVariable = require("./proxy.conf.variable.js")
module.exports = {
"/api/rss": {
"target": "https://www.unige.ch/feed",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
},
"/api/short-doi": {
"target": "http://shortdoi.org",
"pathRewrite": {
"^/api/short-doi": ""
},
"changeOrigin": true,
},
"/dlcm/oauth": {
"target": "http://localhost:16120/dlcm/oauth",
"pathRewrite": {
"^/dlcm/oauth": ""
},
},
"/dlcm/shiblogin": {
"target": "http://localhost:16120",
"onProxyReq": (proxyReq, req, res) => {
proxyReq.setHeader('mail', 'Marty.McFly@unige.ch');
proxyReq.setHeader('uniqueid', '999999@unige.ch');
proxyReq.setHeader('givenname', 'Marty');
proxyReq.setHeader('surname', 'McFly');
proxyReq.setHeader('homeorganization', 'unige.ch');
proxyReq.setHeader('preferredlanguage', 'fr-ch');
},
"onProxyRes": (proxyRes, req, res) => {
proxyRes.headers['Access-Control-Allow-Origin'] = 'http://localhost:4200';
}
}
...proxyConfVariable.rss,
...proxyConfVariable.shortDoi,
...proxyConfVariable.oauth(16120),
...proxyConfVariable.shiblogin(16120),
...proxyConfLocal.obj,
}
exports.rss = {
"/api/rss": {
"target": "https://www.unige.ch/feed",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
},
}
exports.shortDoi = {
"/api/short-doi": {
"target": "http://shortdoi.org",
"pathRewrite": {
"^/api/short-doi": ""
},
"changeOrigin": true,
},
}
exports.oauth = (port) => {
return {
"/dlcm/oauth": {
"target": `http://localhost:${port}/dlcm/oauth`,
"pathRewrite": {
"^/dlcm/oauth": ""
},
},
}
}
exports.shiblogin = (port) => {
return {
"/dlcm/shiblogin": {
"target": `http://localhost:${port}`,
"onProxyReq": (proxyReq, req, res) => {
proxyReq.setHeader('mail', 'Marty.McFly@unige.ch');
proxyReq.setHeader('uniqueid', '999999@unige.ch');
proxyReq.setHeader('givenname', 'Marty');
proxyReq.setHeader('surname', 'McFly');
proxyReq.setHeader('homeorganization', 'unige.ch');
proxyReq.setHeader('preferredlanguage', 'fr-ch');
},
"onProxyRes": (proxyRes, req, res) => {
proxyRes.headers['Access-Control-Allow-Origin'] = 'http://localhost:4200';
}
},
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment