Skip to content

Commit

Permalink
fix config logging and README
Browse files Browse the repository at this point in the history
  • Loading branch information
jchartrand committed May 15, 2024
1 parent d53a836 commit e018e31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Which is a convenience method for generating a new signing key, encoded as a [De

* GET /healthz

Which is an endpoint typically meant to be called by the Docker HEALTHCHECK option for a specific service. Read more below in the [Health Check](#health-check) section.
Which is an endpoint typically meant to be called by the Docker [HEALTHCHECK](https://docs.docker.com/reference/dockerfile/#healthcheck) option for a specific service. Read more below in the [Health Check](#health-check) section.

The signing endpoint is meant to be called as a RESTful service from any software wanting to sign a credential, and in particular is so used by the [DCC issuer-coordinator](https://github.com/digitalcredentials/issuer-coordinator) and the [DCC workflow-coordinator](https://github.com/digitalcredentials/worfklow-coordinator) from within a Docker Compose network.

Expand Down Expand Up @@ -87,8 +87,9 @@ There is a sample .env file provided called .env.example to help you get started
| `PORT` | http port on which to run the express app | 4006 | no |
| `ENABLE_HTTPS_FOR_DEV` | runs the dev server over https - ONLY FOR DEV - typically to allow CORS calls from a browser | false | no |
| `TENANT_SEED_{TENANT_NAME}` | see [tenants](#tenants) section for instructions | no | no |
|`TENANT_DIDMETHOD_{TENANT_NAME}` | did method (`key` or `web`) to use for signing on this tenant | `key` | no |
| `TENANT_DIDMETHOD_{TENANT_NAME}` | did method (`key` or `web`) to use for signing on this tenant | `key` | no |
| `TENANT_DID_URL_{TENANT_NAME}` | url to use for did:web | | no |
| `ENABLE_ACCESS_LOGGING` | log all http calls to the service - see [Logging](#logging) | true | no |
| `ERROR_LOG_FILE` | log file for all errors - see [Logging](#logging) | no | no |
| `LOG_ALL_FILE` | log file for everything - see [Logging](#logging) | no | no |
| `CONSOLE_LOG_LEVEL` | console log level - see [Logging](#logging) | silly | no |
Expand Down Expand Up @@ -541,6 +542,10 @@ Logging is configured with environment variables, as defined in the [Environment

By default, everything is logged to the console (log level `silly`).

All http calls to the service are logged by default, which might bloat the log. You can disable access logging with:

```ENABLE_ACCESS_LOGGING=false```

You may set the log level for the application as whole, e.g.,

```LOG_LEVEL=http```
Expand Down
5 changes: 3 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ async function parseTenantSeeds() {
function parseConfig() {
const env = process.env
const config = Object.freeze({
port: env.PORT ? parseInt(env.PORT) : defaultPort,
enableHttpsForDev: env.ENABLE_HTTPS_FOR_DEV?.toLowerCase() === 'true',
enableAccessLogging: env.ENABLE_ACCESS_LOGGING?.toLowerCase() === 'true',
consoleLogLevel:
env.CONSOLE_LOG_LEVEL?.toLocaleLowerCase() || defaultConsoleLogLevel,
logLevel: env.LOG_LEVEL?.toLocaleLowerCase() || defaultLogLevel,
errorLogFile: env.ERROR_LOG_FILE,
logAllFile: env.LOG_ALL_FILE,
port: env.PORT ? parseInt(env.PORT) : defaultPort
logAllFile: env.LOG_ALL_FILE
})
return config
}
Expand Down

0 comments on commit e018e31

Please sign in to comment.