mirror of
https://github.com/mageddo/dns-proxy-server.git
synced 2026-04-25 09:25:56 +03:00
[GH-ISSUE #76] Manual Configuration: multiple environments #33
Labels
No labels
bug
confirmed
discussion
duplicate
enhancement
feature
feature-request
not-planned
pull-request
secondary-feature
stale
triage
waiting-feedback
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/dns-proxy-server-mageddo#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mageddo on GitHub (Jun 4, 2018).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/76
Context
When you use DPS local storage you can register many hostname records referring a custom IP, that way you can use hostnames instead of static IPs then change the IPs when it comes necessary in one place. It have nothing with docker, just DPS working like a DNS with advanced settings
Use case Proposal
It would be nice if you can register many environments so you can register multiple IPs for the same hostname then you can point to a different IP by switching the environment.
Example
Let's say you own acme.com and is coding on that, you probably want to access acme.com pointing to your local machine instead of production, so you would use Dev environment that has a
127.0.0.1entry at acme.com.If you are testing QA then you swap to QA environment.
Then to default/prod when want to see it in prod, this environment probably have no entries so DPS will solve to the real IP
Requirements
@josielrocha commented on GitHub (Jul 6, 2019):
Hello @mageddo!
I've forked your project (https://github.com/josielrocha/dns-proxy-server) and I'm trying to implement this feature.. I found something that I need to know from you about how to deal with it.
Step by step:
It seems to be caching the query result without respecting the environment.. It is like the cache key is composed only by hostname
UI with Test environment and acme.com host

UI with Default environment and acme.com host

Is it expected? Do I need to clear caches after switching environments?
@mageddo commented on GitHub (Jul 6, 2019):
Yep, take a look at the file which read the json configuration file,it caches the entire file, you will have to clear the cache
@mageddo commented on GitHub (Jul 6, 2019):
Are you calling the method https://github.com/mageddo/dns-proxy-server/blob/master/events/local/local.go#L172 when setting the active env? It should do the trick cause it store the changes to the file and also clear the cache
@josielrocha commented on GitHub (Jul 6, 2019):
The REST API is working perfectly fine.. The problem occurs when we send queries to the Dns Proxy Server..
I was looking the code and I believe we need to pass active environment to Local and Cache solvers in this line (https://github.com/mageddo/dns-proxy-server/blob/master/dns.go#L74) or let Cache and Local solvers know which one is the current environment.
Do you agree with my point?
@mageddo commented on GitHub (Aug 23, 2019):
DNS resolution is working fine, I tested it, you have to change active env first
@mageddo commented on GitHub (Aug 23, 2019):
Some changes will be necessary on the webpage api clients though, they must pass the env where the hostname will be created, deleted, etc.
@mageddo commented on GitHub (Aug 25, 2019):
Yep, DPS is really having issues when the environment is switched, I think the cache must be cleared, I'm working on it
@mageddo commented on GitHub (Aug 25, 2019):
#155 created to fix env switch resolution issues
@mageddo commented on GitHub (Aug 26, 2019):
@josielrocha I've forked your branch, made some minor changes then merged it #154
@mageddo commented on GitHub (Aug 26, 2019):
@josielrocha here your credits