Add approuter
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,3 +15,6 @@ default-env.json
|
||||
packages/messageBox
|
||||
reviews/msg-box
|
||||
reviews/db/test.db
|
||||
|
||||
package-lock.json
|
||||
logs_recent_*.txt
|
||||
Binary file not shown.
Binary file not shown.
54
multitenancy/Makefile_20210504145509.mta
Normal file
54
multitenancy/Makefile_20210504145509.mta
Normal file
@@ -0,0 +1,54 @@
|
||||
# Generated with Cloud MTA Build Tool version 1.0.14
|
||||
version=0.0.1
|
||||
MBT=/usr/local/lib/node_modules/mbt/unpacked_bin/mbt
|
||||
ifndef p
|
||||
$(error platform flag is expected. e.g. use make -f makefile.mta p=cf)
|
||||
endif
|
||||
target_provided=true
|
||||
ifndef t
|
||||
t="$(CURDIR)"
|
||||
target_provided=false
|
||||
endif
|
||||
ifndef strict
|
||||
strict=true
|
||||
endif
|
||||
ifndef mtar
|
||||
mtar="*"
|
||||
endif
|
||||
modules := $(shell $(MBT) provide modules -d=dev)
|
||||
modules := $(subst ],,$(subst [,,$(modules)))
|
||||
# List of all the recipes to be executed during the build process
|
||||
.PHONY: all pre_validate pre_build validate $(modules) post_build meta mtar cleanup
|
||||
# Default target compile all
|
||||
all: pre_validate pre_build validate $(modules) post_build meta mtar cleanup
|
||||
# Validate mta.yaml
|
||||
pre_validate:
|
||||
@$(MBT) validate -r=${strict} -x="paths"
|
||||
pre_build: pre_validate
|
||||
@$(MBT) project build -p=pre
|
||||
|
||||
|
||||
# Execute module build
|
||||
define build_rule
|
||||
$(1): validate
|
||||
@$(MBT) module build -m=$(1) -p=${p} -t=${t}
|
||||
endef
|
||||
|
||||
$(foreach mod,$(modules),$(eval $(call build_rule,$(mod))))# Create META-INF folder with MANIFEST.MF & mtad.yaml
|
||||
meta: $(modules) post_build
|
||||
@$(MBT) gen meta -p=${p} -t=${t}
|
||||
|
||||
post_build: $(modules)
|
||||
@$(MBT) project build -p=post -t=${t}
|
||||
|
||||
# Validate mta.yaml
|
||||
validate: pre_build
|
||||
@$(MBT) validate -r=${strict}
|
||||
|
||||
# Pack as MTAR artifact
|
||||
mtar: $(modules) meta
|
||||
@$(MBT) gen mtar --mtar=${mtar} --target_provided=${target_provided} -t=${t}
|
||||
|
||||
cleanup: mtar
|
||||
# Remove tmp folder
|
||||
@$(MBT) clean -t=${t}
|
||||
19
multitenancy/app/package.json
Normal file
19
multitenancy/app/package.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "approuter",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"devDependencies": {},
|
||||
"engines": {
|
||||
"node": "^12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node node_modules/@sap/approuter/approuter.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@sap/approuter": ">=9.0.2"
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
using from './admin/fiori-service';
|
||||
using from './browse/fiori-service';
|
||||
using from './orders/fiori-service';
|
||||
using from './common';
|
||||
|
||||
using from '../db/capire_common';
|
||||
|
||||
// only works in case of embedded orders service
|
||||
// using from './orders/app/orders/fiori-service';
|
||||
|
||||
28
multitenancy/app/xs-app.json
Normal file
28
multitenancy/app/xs-app.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"welcomeFile": "/admin-fiori.html",
|
||||
"authenticationMethod": "route",
|
||||
"sessionTimeout": 30,
|
||||
"logout": {
|
||||
"logoutEndpoint": "/do/logout",
|
||||
"logoutPage": "/"
|
||||
},
|
||||
"routes": [
|
||||
{
|
||||
"source": "^/((admin|browse|orders)/webapp/.*)$",
|
||||
"target": "$1",
|
||||
"localDir": ".",
|
||||
"authenticationType": "xsuaa"
|
||||
},
|
||||
{
|
||||
"source": "^(/[^/]+\\.html(\\?.*)?)$",
|
||||
"target": "$1",
|
||||
"localDir": ".",
|
||||
"authenticationType": "xsuaa"
|
||||
},
|
||||
{
|
||||
"source": "^.*$",
|
||||
"destination": "srv-api",
|
||||
"authenticationType": "xsuaa"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using from './schema_bookshop';
|
||||
using from './schema_orders';
|
||||
|
||||
annotate cds.UUID with @(Core.Computed : true);
|
||||
|
||||
8
multitenancy/map-route.sh
Executable file
8
multitenancy/map-route.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
SUBDOMAIN=mtx-extend-bookshop
|
||||
SAAS_HOST_SUFFIX="$(cf env multitenancy-approuter | grep TENANT_HOST_PATTERN | sed 's/.*(..)//' | sed 's/\..*//')"
|
||||
SAAS_DOMAIN="$(cf env multitenancy-approuter | grep TENANT_HOST_PATTERN | sed 's/.*(..)//' | sed 's/[^.]*\.//')"
|
||||
|
||||
cf map-route multitenancy-approuter $SAAS_DOMAIN --hostname $SUBDOMAIN$SAAS_HOST_SUFFIX
|
||||
@@ -8,7 +8,7 @@ version: 1.0.0
|
||||
description: "A simple CAP project."
|
||||
parameters:
|
||||
enable-parallel-deployments: true
|
||||
|
||||
|
||||
build-parameters:
|
||||
before-all:
|
||||
- builder: custom
|
||||
@@ -17,6 +17,26 @@ build-parameters:
|
||||
- npx -p @sap/cds-dk cds build --production
|
||||
|
||||
modules:
|
||||
|
||||
- name: multitenancy-approuter
|
||||
type: nodejs
|
||||
path: app
|
||||
parameters:
|
||||
# Keep existing URLs for this application ("routes")
|
||||
keep-existing-routes: true
|
||||
properties:
|
||||
TENANT_HOST_PATTERN: "^(.*)-${default-host}.${default-domain}"
|
||||
requires:
|
||||
- name: multitenancy-registry
|
||||
- name: multitenancy-uaa-mt
|
||||
- name: srv-api
|
||||
group: destinations
|
||||
properties:
|
||||
forwardAuthToken: true
|
||||
strictSSL: true
|
||||
name: srv-api
|
||||
url: ~{srv-url}
|
||||
|
||||
# --------------------- SERVER MODULE ------------------------
|
||||
- name: multitenancy-srv
|
||||
# ------------------------------------------------------------
|
||||
@@ -57,7 +77,7 @@ resources:
|
||||
type: org.cloudfoundry.managed-service
|
||||
parameters:
|
||||
service: xsuaa
|
||||
service-plan: application
|
||||
service-plan: application
|
||||
path: ./xs-security.json
|
||||
config:
|
||||
xsappname: multitenancy-${space} # name + space dependency
|
||||
@@ -67,11 +87,11 @@ resources:
|
||||
type: org.cloudfoundry.managed-service
|
||||
requires:
|
||||
- name: multitenancy-uaa-mt
|
||||
- name: mtx-api
|
||||
properties:
|
||||
prop: ~{mtx-url}
|
||||
parameters:
|
||||
param: ~{mtx-url}
|
||||
- name: mtx-api
|
||||
properties:
|
||||
prop: ~{mtx-url}
|
||||
parameters:
|
||||
param: ~{mtx-url}
|
||||
parameters:
|
||||
service: saas-registry
|
||||
service-plan: application
|
||||
|
||||
@@ -48,36 +48,38 @@
|
||||
}
|
||||
},
|
||||
"cds": {
|
||||
"requires": {
|
||||
"multitenancy": true,
|
||||
"auth": {
|
||||
"strategy": "JWT"
|
||||
},
|
||||
"db": {
|
||||
"kind": "hana",
|
||||
"vcap": {
|
||||
"label": "service-manager"
|
||||
"[production]": {
|
||||
"requires": {
|
||||
"multitenancy": true,
|
||||
"auth": {
|
||||
"strategy": "JWT"
|
||||
},
|
||||
"db": {
|
||||
"kind": "hana",
|
||||
"vcap": {
|
||||
"label": "service-manager"
|
||||
}
|
||||
},
|
||||
"uaa": {
|
||||
"kind": "xsuaa"
|
||||
}
|
||||
},
|
||||
"uaa": {
|
||||
"kind": "xsuaa"
|
||||
}
|
||||
},
|
||||
"hana": {
|
||||
"deploy-format": "hdbtable"
|
||||
},
|
||||
"mtx": {
|
||||
"element-prefix": "Z_",
|
||||
"namespace-blacklist": [
|
||||
"com.sap.",
|
||||
"sap."
|
||||
],
|
||||
"entity-whitelist": [],
|
||||
"service-whitelist": []
|
||||
},
|
||||
"auth": {
|
||||
"passport": {
|
||||
"strategy": "JWT"
|
||||
"hana": {
|
||||
"deploy-format": "hdbtable"
|
||||
},
|
||||
"mtx": {
|
||||
"element-prefix": "Z_",
|
||||
"namespace-blacklist": [
|
||||
"com.sap.",
|
||||
"sap."
|
||||
],
|
||||
"entity-whitelist": [],
|
||||
"service-whitelist": []
|
||||
},
|
||||
"auth": {
|
||||
"passport": {
|
||||
"strategy": "JWT"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user