-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
82 lines (79 loc) · 2.47 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require('path')
const { NginxBuilder } = require( "./dist/index" );
const nginxBuilder = new NginxBuilder({
outputPath: path.resolve(__dirname, "config"),
fileName: "docker.webserver.conf",
apps: [
{
name: "app1",
serverName: "app1.domain.local app1.domain.ch",
port: 80,
proxy: [
{
locationPath:' /api/docs/',
host: "http://host.docker.internal",
path:'/swagger/',
port: 8003,
},
{
locationPath:' /api',
host: "http://host.docker.internal",
path:'/api/',
port: 8003,
},
{
locationPath: "^/api/app/(?<endpoint>.+)$",
path: "/api",
host: "$endpoint.app.external.ch",
options:{
locationPrefix:'~',
https: true,
rewrite:'^/api/app/(.+) /api break',
}
},
],
locations:[
{
locationPath:'/',
path: "/var/www/app1",
}
]
},
{
name: "app2",
serverName: "app2.domain.local app2.domain.ch",
port: 80,
proxy: [
{
locationPath:' /api',
host: "http://host.docker.internal",
path:'/api/',
port: 8004,
},
{
locationPath:' /api/docs/',
host: "http://host.docker.internal",
path:'/swagger/',
port: 8004,
},
{
locationPath:' /api/file/image/',
host: "http://host.docker.internal",
path:'/api/upload/',
port: 8005,
}
],
locations:[
{
locationPath:'/',
path: "/var/www/app2",
}
]
},
],
})
nginxBuilder.saveToFile(nginxBuilder.build(),{
spaces: 2, // Use 2 spaces for indentation
tabs: 0, // No tabs (use spaces)
dontJoinCurlyBracet: false // Places curly braces on new lines
})