Skip to content

Commit 7c68a5a

Browse files
Rename domain to host
1 parent e08fa71 commit 7c68a5a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ serve ~/myproj
4343
- `sudo` may be necessary.
4444
- If a static path is not provided the current directory content will be served.
4545
- You can change the **port** setting the `PORT` environmental variable: `PORT=4433 serve ~/myproj`. Specifying port number will also prevent http to https redirect.
46-
- You can change the **domain** setting the `DOMAIN` environmental variable: `DOMAIN=192.168.0.2 serve ~/myproj`.
46+
- You can change the **host** setting the `HOST` environmental variable: `HOST=example.com serve ~/myproj`.
4747

4848
### Binaries
4949
If you don't have Node.js installed just use a packaged version! Download it from the [release page](https://github.com/daquinoaldo/https-localhost/releases).

certs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async function generate(appDataPath = CERT_PATH, customDomain = undefined) {
138138
}
139139

140140
async function getCerts(customDomain = undefined) {
141-
const domain = process.env.DOMAIN || customDomain || "localhost"
141+
const domain = process.env.HOST || customDomain || "localhost"
142142
const certPath = process.env.CERT_PATH || CERT_PATH
143143
// check for updates if running as executable
144144
/* istanbul ignore if: cannot test pkg */

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const getCerts = require(path.resolve(__dirname, "certs.js")).getCerts
1414
/* CONFIGURE THE SERVER */
1515

1616
// SSL certificate
17-
const createServer = (domain = process.env.DOMAIN || "localhost") => {
17+
const createServer = (domain = process.env.HOST || "localhost") => {
1818
// create a server with express
1919
const app = express()
2020

test/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe("Testing certs", function() {
154154
it("works with environment domain", function(done) {
155155
(async() => {
156156
// set the environment domain
157-
process.env.DOMAIN = "192.168.0.1"
157+
process.env.HOST = "192.168.0.1"
158158

159159
// Get the cert
160160
const appCerts = await app.getCerts()
@@ -172,7 +172,7 @@ describe("Testing certs", function() {
172172
const certDomain = cert.subjectaltname.split(":")[1]
173173

174174
// Compare the domains
175-
assert(certDomain === process.env.DOMAIN)
175+
assert(certDomain === process.env.HOST)
176176

177177
done()
178178
})()

0 commit comments

Comments
 (0)