-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Changed filenames to include first domain or inbound port #5515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joewesch
wants to merge
1
commit into
NginxProxyManager:develop
Choose a base branch
from
joewesch:746_better-filenames
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { describe, it } from "node:test"; | ||
| import { getNginxFileStem } from "../lib/utils.js"; | ||
| import internalNginx from "./nginx.js"; | ||
|
|
||
| describe("internalNginx.getConfigName", () => { | ||
| it("returns default host path unchanged", () => { | ||
| assert.equal(internalNginx.getConfigName("default", {}), "/data/nginx/default_host/site.conf"); | ||
| }); | ||
|
|
||
| it("returns id-only basename when HTTP host has no domains", () => { | ||
| assert.equal( | ||
| internalNginx.getConfigName("proxy_host", { id: 10, domain_names: [] }), | ||
| "/data/nginx/proxy_host/10.conf", | ||
| ); | ||
| }); | ||
|
|
||
| it("returns id.domain basename when HTTP host has domains", () => { | ||
| assert.equal( | ||
| internalNginx.getConfigName("proxy_host", { id: 5, domain_names: ["www.TEST.example"] }), | ||
| "/data/nginx/proxy_host/5.www.test.example.conf", | ||
| ); | ||
| }); | ||
|
|
||
| it("returns id.port basename for streams", () => { | ||
| assert.equal( | ||
| internalNginx.getConfigName("stream", { id: 2, incoming_port: 9000 }), | ||
| "/data/nginx/stream/2.9000.conf", | ||
| ); | ||
| }); | ||
|
|
||
| it("falls back to id only for unknown host types", () => { | ||
| assert.equal( | ||
| internalNginx.getConfigName("future_host_kind", { id: 42, domain_names: ["ignored.example"] }), | ||
| "/data/nginx/future_host_kind/42.conf", | ||
| ); | ||
| }); | ||
|
|
||
| it("config path uses the same stem as utils.getNginxFileStem", () => { | ||
| const nice = "proxy_host"; | ||
| const host = { id: 7, domain_names: ["sync.test"] }; | ||
| const stem = getNginxFileStem(nice, host); | ||
| assert.equal(internalNginx.getConfigName(nice, host), `/data/nginx/${nice}/${stem}.conf`); | ||
| }); | ||
| }); | ||
|
|
||
| describe("internalNginx.renameStaleLogsAfterConfigWrite", () => { | ||
| it("no-ops for host kinds without per-host logs", () => { | ||
| assert.doesNotThrow(() => internalNginx.renameStaleLogsAfterConfigWrite("default", { id: 1 })); | ||
| }); | ||
|
|
||
| it("no-ops when host id is missing", () => { | ||
| assert.doesNotThrow(() => internalNginx.renameStaleLogsAfterConfigWrite("proxy_host", {})); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually incorrect. The
hostconstant was already created as a clone (deep copy) of thehost_rowfrom the caller just a few lines above to prevent this exact situation (hence the comment):nginx-proxy-manager/backend/internal/nginx.js
Lines 188 to 190 in 9875a76