Skip to content
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

Configure remote paths #68

Merged
merged 8 commits into from
Nov 6, 2022

Conversation

cbundy
Copy link
Contributor

@cbundy cbundy commented Oct 29, 2022

Adds a new Environment Variable PRIMARY/SECONDARY...PATH for primary and secondary servers

  • Allows users to override the default path that their Pi-hole web interface is available under
  • Introduces a new class for managing the host configuration
  • Handles many combinations of Base URL and Path that could already exist

This is quite noisy, but I hope I can make up by making sure it's at least well tested....

I tried a simpler approach, but while it worked it left some confusion in the codebase around baseUrl, so I've moved everything to use fullUrl and now we have both path and baseUrl as two separate values. This can be undone if it seems unnecessary.

I've tried to ensure that I catch as many backward compatibility tests it needs, such as if people are already providing some path within their baseUrl (because the need here was to remove the default /admin value only). I've made the assumption that there are people out there who may already be defining some path values in their baseUrl, this approach should not cause any impact for them.

I've never used typescript and I'm not really a practiced JS developer, so let me know if anything seems out of place or where I could make improvements.


Closes #62

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2022

Codecov Report

Base: 99.55% // Head: 99.58% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (61a84b2) compared to base (00a9dfe).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
+ Coverage   99.55%   99.58%   +0.02%     
==========================================
  Files           6        6              
  Lines         225      239      +14     
  Branches       46       51       +5     
==========================================
+ Hits          224      238      +14     
  Misses          1        1              
Impacted Files Coverage Δ
src/client.ts 100.00% <100.00%> (ø)
src/config.ts 100.00% <100.00%> (ø)
src/notify.ts 98.41% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/config.ts Outdated Show resolved Hide resolved
@mattwebbio
Copy link
Owner

mattwebbio commented Nov 1, 2022

This is awesome! I've just pushed up a prerelease to test. There was one comment that seems to have snuck in to your commits, but I'll run the prerelease for a couple days and once that's addressed this looks good to merge!

src/client.ts Outdated Show resolved Hide resolved
@cbundy
Copy link
Contributor Author

cbundy commented Nov 1, 2022

Cheers, I missed running the tests again and forgot before I pushed.

@mattwebbio mattwebbio force-pushed the configure-remote-paths branch from 61a84b2 to 92c2339 Compare November 6, 2022 01:33
@mattwebbio mattwebbio merged commit ec653f7 into mattwebbio:master Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow paths to pi-hole that don't contain /admin
3 participants