Skip to content

Commit

Permalink
defaults for .env's
Browse files Browse the repository at this point in the history
  • Loading branch information
lathoub committed Sep 14, 2024
1 parent 053bef6 commit dd219a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
FROM --platform=linux/amd64 node:alpine AS build_amd64
FROM --platform=linux/arm64 node:alpine AS build_arm64

LABEL maintainer="Bart De Lathouwer <[email protected]>"

# Create app directory, our data will be in /usr/local/bin
WORKDIR /usr/local/bin/ocapi

Expand Down
7 changes: 4 additions & 3 deletions local.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ metadata:
title: Geonovum OGC API Demo Service
description: This OGC API Service is provided by Geonovum from instructional purposes only. The code onGitHub is written with readability in mind, not performance.
keywords:
- geospatial
- data
- api
- geospatial
- data
- api
contact:
contactName: Jane Doe
contactEmail: [email protected]
Expand All @@ -29,6 +29,7 @@ metadata:
license:
name: CC0 1.0
url: http://creativecommons.org/publicdomain/zero/1.0/deed.nl

api:
version: 1.2.3
buildingBlock: CRS
Expand Down
8 changes: 6 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const app = express();
const __dirname = import.meta.dirname;
if (__dirname === undefined) console.log("need node 20.16 or higher");

process.env.ID = process.env.ID || "demoservice";
process.env.APIVERSION = process.env.APIVERSION || "1.2.3";
process.env.PORT = process.env.PORT || 8080;
process.env.LIMIT = process.env.LIMIT || 10;

const configPath = join(__dirname, "..");
const yamlStr = readFileSync(join(configPath, `local.config.yml`));
global.config = YAML.parse(yamlStr.toString());
Expand Down Expand Up @@ -67,10 +72,9 @@ app.use(encodings);
app.use(apiVersion);

// Mount API on this path
const mountPath = process.env.ID; // from config
// (ADR) /core/uri-version: Include the major version number in the URI
// https://gitdocumentatie.logius.nl/publicatie/api/adr/#/core/uri-version
const serviceRoot = `/${mountPath}/v${major(process.env.APIVERSION)}`;
const serviceRoot = `/${process.env.ID}/v${major(process.env.APIVERSION)}`;

app.use(serviceRoot, oapifp1);
app.use(serviceRoot, oapifp3);
Expand Down

0 comments on commit dd219a9

Please sign in to comment.