diff --git a/.npmignore b/.npmignore index 05533e83..a805f67a 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1 @@ -/docs/dumps \ No newline at end of file +/docs/dumps/ \ No newline at end of file diff --git a/api.js b/api.js index 1ad8d0a8..6f126a6a 100644 --- a/api.js +++ b/api.js @@ -1,5 +1,6 @@ import {createClient} from './index.js'; import {profile as dbProfile} from './p/db/index.js'; +import {profile as dbnavProfile} from './p/dbnav/index.js'; import {createHafasRestApi as createApi} from 'hafas-rest-api'; import {loyaltyCardParser} from 'db-rest/lib/loyalty-cards.js'; import {parseBoolean, parseInteger} from 'hafas-rest-api/lib/parse.js'; @@ -33,7 +34,7 @@ const config = { name: 'db-vendo-client', description: 'db-vendo-client', homepage: 'https://github.com/public-transport/db-vendo-client', - version: '6.2.0', + version: '6.3.0', docsLink: 'https://github.com/public-transport/db-vendo-client', openapiSpec: true, logging: true, @@ -46,7 +47,11 @@ const config = { const start = async () => { - const vendo = createClient(dbProfile, process.env.USER_AGENT || process.env.HOSTNAME || 'link-to-your-project-or-email', config); + const vendo = createClient( + process.env.DB_PROFILE == 'db' ? dbProfile : dbnavProfile, + process.env.USER_AGENT || 'link-to-your-project-or-email', + config, + ); const api = await createApi(vendo, config); api.listen(config.port, (err) => { diff --git a/index.js b/index.js index 4436f54e..b94c4c8a 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,7 @@ const FORBIDDEN_USER_AGENTS = [ 'my-awesome-program', // previously used in readme.md, p/*/readme.md & docs/*.md 'hafas-client-example', // previously used in p/*/example.js 'link-to-your-project-or-email', // now used throughout + 'db-vendo-client', ]; const isNonEmptyString = str => 'string' === typeof str && str.length > 0; diff --git a/package-lock.json b/package-lock.json index da0177ac..3862110c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "db-vendo-client", - "version": "6.2.0", + "version": "6.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "db-vendo-client", - "version": "6.2.0", + "version": "6.3.0", "license": "ISC", "dependencies": { "@derhuerst/br2nl": "^1.0.0", diff --git a/package.json b/package.json index 853337fa..bd78d4a7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "db-vendo-client", "description": "Client for bahn.de public transport APIs.", - "version": "6.2.0", + "version": "6.3.0", "type": "module", "main": "index.js", "files": [ diff --git a/readme.md b/readme.md index f5da5720..6bbb7326 100644 --- a/readme.md +++ b/readme.md @@ -57,10 +57,14 @@ Use it as a dependency, e.g. just replacing [hafas-client](https://github.com/pu npm i db-vendo-client ``` -See an example in [api.js](api.js). It shows how you can use `db-vendo-client` together with [hafas-rest-api](https://github.com/public-transport/hafas-rest-api/) in order to run a [FPTF](https://github.com/public-transport/friendly-public-transport-format) API server. The [Dockerfile](Dockerfile) serves this API (using the `db` profile): +See an example in [api.js](api.js). It shows how you can use `db-vendo-client` together with [hafas-rest-api](https://github.com/public-transport/hafas-rest-api/) in order to run a [FPTF](https://github.com/public-transport/friendly-public-transport-format) API server. The [Dockerfile](Dockerfile) serves this API (using the `dbnav` profile): ``` -docker run -e USER_AGENT=my-awesome-program -p 3000:3000 ghcr.io/public-transport/db-vendo-client +docker run \ + -e USER_AGENT=my-awesome-program \ + -e DB_PROFILE=dbnav \ + -p 3000:3000 \ + ghcr.io/public-transport/db-vendo-client ``` There are [community-maintained TypeScript typings available as `@types/hafas-client`](https://www.npmjs.com/package/@types/hafas-client).