Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PDSLLabs Public
QMSL
PDFGenerator QMSL
Commits
7060d9fa
Commit
7060d9fa
authored
Mar 25, 2021
by
Julia Dürselen
🚒
Committed by
Uta Christoph
Mar 25, 2021
Browse files
Feature/internal routing into master
parent
bd4e927b
Changes
5
Show whitespace changes
Inline
Side-by-side
nomad/dev.nomad.example
View file @
7060d9fa
...
...
@@ -25,8 +25,8 @@ job "pdf-generator" {
#
# You may want this to be full paths to your local repo build on dev
args = [
"
C:\\Users\\userid\\Source\\Repos\\pdf-generator
\\pdf-generator\\bin\\Debug\\netcoreapp3.1\\pdf-generator.dll",
"
C:\\Users\\userid\\Source\\Repos\\pdf-generator
\\pdf-generator\\bin\\Debug\\netcoreapp3.1\\appsettings.
Development.
json"
"
PATH_TO_PDF-GENERATOR_MICROSERVICE
\\pdf-generator\\bin\\Debug\\netcoreapp3.1\\pdf-generator.dll",
"
PATH_TO_PDF-GENERATOR_MICROSERVICE
\\pdf-generator\\bin\\Debug\\netcoreapp3.1\\appsettings.json"
]
}
...
...
@@ -43,6 +43,7 @@ job "pdf-generator" {
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.pdfgenerator.entrypoints=internal",
"traefik.Path=/${NOMAD_TASK_NAME}"
]
...
...
nomad/live.nomad
View file @
7060d9fa
...
...
@@ -33,7 +33,7 @@ job "pdf-generator" {
ASPNETCORE_URLS
=
"http://*:${NOMAD_PORT_http}"
,
# Pass the basedir used by Traefik to the app
ASPNETCORE_BASEPATH
=
"/
internal/
${NOMAD_TASK_NAME}"
ASPNETCORE_BASEPATH
=
"/${NOMAD_TASK_NAME}"
}
service
{
...
...
@@ -41,7 +41,8 @@ job "pdf-generator" {
port
=
"http"
tags
=
[
"traefik.enable=true"
,
"traefik.Path=/internal/${NOMAD_TASK_NAME}"
"traefik.http.routers.pdflive.entrypoints=internal"
,
"traefik.Path=/${NOMAD_TASK_NAME}"
]
# The check URL needs to answer with status 200, preferbly use something like a version API call
...
...
nomad/testing.nomad
View file @
7060d9fa
...
...
@@ -33,7 +33,7 @@ job "pdf-generator-testing" {
ASPNETCORE_URLS
=
"http://*:${NOMAD_PORT_http}"
,
# Pass the basedir used by Traefik to the app
ASPNETCORE_BASEPATH
=
"/
internal/
${NOMAD_TASK_NAME}"
ASPNETCORE_BASEPATH
=
"/${NOMAD_TASK_NAME}"
}
service
{
...
...
@@ -41,7 +41,8 @@ job "pdf-generator-testing" {
port
=
"http"
tags
=
[
"traefik.enable=true"
,
"traefik.Path=/internal/${NOMAD_TASK_NAME}"
"traefik.http.routers.pdftesting.entrypoints=internal"
,
"traefik.Path=/${NOMAD_TASK_NAME}"
]
# The check URL needs to answer with status 200, preferbly use something like a version API call
...
...
pdf-generator/Program.cs
View file @
7060d9fa
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
NLog.Web
;
...
...
@@ -31,7 +32,7 @@ namespace PDFGenerator
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
{
return
Host
.
CreateDefaultBuilder
(
args
)
IHostBuilder
builder
=
Host
.
CreateDefaultBuilder
(
args
)
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
UseStartup
<
Startup
>();
...
...
@@ -41,6 +42,16 @@ namespace PDFGenerator
logging
.
SetMinimumLevel
(
LogLevel
.
Trace
);
})
.
UseNLog
();
// NLog: Setup NLog for Dependency injection
if
(
args
.
Length
>
0
)
{
builder
.
ConfigureAppConfiguration
(
builder
=>
{
builder
.
AddJsonFile
(
args
[
0
]);
});
}
return
builder
;
}
}
}
pdf-generator/Startup.cs
View file @
7060d9fa
...
...
@@ -13,7 +13,7 @@ namespace PDFGenerator
{
public
const
string
API_TITLE
=
"PDFGenerator API"
;
public
const
string
API_VERSION
=
"v1"
;
public
const
string
API_ENDPOINT
=
"
/swagger/
v1/swagger.json"
;
public
const
string
API_ENDPOINT
=
"v1/swagger.json"
;
public
Startup
(
IConfiguration
configuration
)
{
...
...
@@ -61,12 +61,8 @@ namespace PDFGenerator
app
.
UseCors
(
options
=>
options
.
AllowAnyOrigin
());
app
.
UseHttpsRedirection
();
app
.
UseRouting
();
app
.
UseAuthorization
();
app
.
UseEndpoints
(
endpoints
=>
{
endpoints
.
MapControllers
();
...
...
@@ -77,8 +73,8 @@ namespace PDFGenerator
app
.
UseSwaggerUI
(
c
=>
{
// the Swagger file also needs the correct basePath set here
string
swaggerUrl
=
basePath
!=
"/"
?
basePath
+
API_ENDPOINT
:
API_ENDPOINT
;
c
.
SwaggerEndpoint
(
swaggerUrl
,
API_TITLE
+
' '
+
API_VERSION
);
string
swaggerUrl
=
API_ENDPOINT
;
c
.
SwaggerEndpoint
(
swaggerUrl
,
$"
{
API_TITLE
}
{
API_VERSION
}
"
);
});
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment