Skip to content

Commit

Permalink
README touchups; fix prettier (lint) errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zsteinkamp committed Mar 11, 2024
1 parent 1283b3b commit c2b996a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ For example, `NJS_ACME_SERVER_NAMES` (env var) is the same as `$njs_acme_server_

There are a few pieces that are required to be present in your `nginx.conf` file. The file at [`examples/nginx.conf`](./examples/nginx.conf) shows them all.

The examples here use `js_var` for configuration variables, but keep in mind you can use the equivalent environment variables instead if that works better in your environment.
NOTE: The examples here use `js_var` for configuration variables, but keep in mind you can use the equivalent environment variables instead if that works better in your environment. See the Configuration Variables section above for specifics.

### Config Root
### `nginx.conf` Root
* Ensures the NJS module is loaded.
```nginx
load_module modules/ngx_http_js_module.so;
Expand Down Expand Up @@ -147,7 +147,7 @@ The examples here use `js_var` for configuration variables, but keep in mind you
```nginx
js_shared_dict_zone zone=acme:1m
```
* NOTE: If you want to use a different `js_shared_dict_zone` name, then you need to define the variable `$njs_acme_shared_dict_zone_name` with the name you would like to use.
* NOTE: If you want to use a different `js_shared_dict_zone` name, then you need to define the variable `$njs_acme_shared_dict_zone_name` with the name you would like to use. You can also use the environment variable `NJS_ACME_SHARED_DICT_ZONE_NAME`.
```nginx
js_var $njs_acme_shared_dict_zone_name acme;
```
Expand All @@ -173,7 +173,7 @@ This may also be defined with the environment variable `NJS_ACME_SERVER_NAMES`.
```

### `location` Blocks
* Location to handle ACME challenge requests. This must be accessible from the ACME server.
* Location to handle ACME challenge requests. This must be accessible from the ACME server - in most cases this means accessbile from another host on the Internet if you are using a service like Let's Encrypt.
```nginx
location ~ "^/\.well-known/acme-challenge/[-_A-Za-z0-9]{22,128}$" {
js_content acme.challengeResponse;
Expand Down
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const log = new Logger()
async function clientAutoMode(r: NginxPeriodicSession): Promise<boolean> {
const result = await clientAutoModeInternal(r)
if (!result.success) {
log.error(`clientAutoModeInternal returned an error: ${JSON.stringify(result.info)}`)
log.error(
`clientAutoModeInternal returned an error: ${JSON.stringify(result.info)}`
)
}
return result.success
}
Expand All @@ -54,7 +56,11 @@ async function clientAutoModeWeb(r: NginxHTTPRequest): Promise<void> {
try {
const result = await clientAutoModeInternal(r)
if (!result.success) {
log.error(`clientAutoModeInternal returned an error: ${JSON.stringify(result.info)}`)
log.error(
`clientAutoModeInternal returned an error: ${JSON.stringify(
result.info
)}`
)
}
return r.return(result.success ? 200 : 500, JSON.stringify(result.info))
} catch (e) {
Expand Down Expand Up @@ -89,7 +95,8 @@ async function clientAutoModeInternal(
try {
email = getVariable(r, 'njs_acme_account_email')
} catch {
retVal.info.error = "Nginx variable '$njs_acme_account_email' or 'NJS_ACME_ACCOUNT_EMAIL' environment variable must be set"
retVal.info.error =
"Nginx variable '$njs_acme_account_email' or 'NJS_ACME_ACCOUNT_EMAIL' environment variable must be set"
return retVal
}

Expand Down

0 comments on commit c2b996a

Please sign in to comment.