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

fix(http): fix the problem that ip_header setting does not take effect #23

Merged
merged 1 commit into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ type Config struct {
Database string
LogLevel string `yaml:"log_level"`
Notice noticeConfig
rhttp.Config
DNS dns.Config
MySQL mysql.Config
RMI rmi.Config
FTP ftp.Config
HTTP rhttp.Config
DNS dns.Config
MySQL mysql.Config
RMI rmi.Config
FTP ftp.Config
}
4 changes: 2 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func New(c *Config) *Revsuit {
if c.Token != "" {
s.http.SetToken(c.Token)
}
if c.IpHeader != "" {
s.http.SetIpHeader(c.IpHeader)
if c.HTTP.IpHeader != "" {
s.http.SetIpHeader(c.HTTP.IpHeader)
}
if c.Domain != "" {
s.dns.SetServerDomain(c.Domain)
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (revsuit *Revsuit) getPlatformConfig(c *gin.Context) {
res["ExternalIP"] = revsuit.config.ExternalIP
res["Database"] = revsuit.config.Database
res["LogLevel"] = revsuit.config.LogLevel
res["IpHeader"] = revsuit.config.IpHeader
res["IpHeader"] = revsuit.config.HTTP.IpHeader

c.JSON(200, res)
}
Expand Down Expand Up @@ -194,8 +194,8 @@ func (revsuit *Revsuit) updatePlatformConfig(c *gin.Context) {
log.Info("Update platform config [database] to %s", form["Database"])
}

if form["IpHeader"] != revsuit.config.IpHeader {
revsuit.config.IpHeader = form["IpHeader"]
if form["IpHeader"] != revsuit.config.HTTP.IpHeader {
revsuit.config.HTTP.IpHeader = form["IpHeader"]
revsuit.http.SetIpHeader(form["IpHeader"])
log.Info("Update http config [ip_header] to %s", form["IpHeader"])
}
Expand Down