Skip to content

Commit

Permalink
added global.config.server to config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lathoub committed Sep 14, 2024
1 parent a3a0173 commit 90df787
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 12 additions & 0 deletions local.config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
server:
viewEngine: pug
encoding: utf-8
language: en-US
cors: true
x-powered-by: false
prettyPrint: true
limit: 10
map:
url: https://tile.openstreetmap.org/{z}/{x}/{y}.png
attribution: 'Map data &copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'

metadata:
identification:
title: Geonovum OGC API Demo Service
Expand Down
11 changes: 7 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ app.use(
})
);

app.set("json spaces", 2); // TODO: only when running DEBUG
if (global.config.server && global.config.server.prettyPrint)
app.set("json spaces", 2); // TODO: only when running DEBUG

// Deal with 'options' prior to cors,
app.options("*", mwOptions);
Expand All @@ -40,10 +41,10 @@ app.options("*", mwOptions);
// cross-origin requests SHOULD be supported.
// Note that support can also be added in a proxy layer on top of the server.
// (OAPIC P1) 8.5 Support for Cross-Origin Requests
app.use(cors()); // Enable All CORS Requests
if (global.config.server && global.config.server.cors) app.use(cors()); // Enable All CORS Requests

// For HTML rendering
app.set("view engine", "pug");
app.set("view engine", global.config.server.viewEngine || "pug");
app.set("views", join(__dirname, "views"));

app.use(favicon(join(__dirname, "public", "images", "favicon.ico")));
Expand All @@ -54,7 +55,9 @@ app.use(json());

// No need to tell the world what tools we are using, it only gives
// out information to not-so-nice people
app.disable("x-powered-by");
if (global.config.server && global.config.server["x-powered-by"])
app.enable("x-powered-by");
else app.disable("x-powered-by");

// setup middleware to decode the content-type
// see http://docs.opengeospatial.org/is/17-069r3/17-069r3.html#_encodings
Expand Down

0 comments on commit 90df787

Please sign in to comment.