redis-enable is now in hosts
This commit is contained in:
		
							
								
								
									
										2
									
								
								hosts.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								hosts.go
									
									
									
									
									
								
							@ -20,7 +20,7 @@ func NewHosts(hs HostsSettings, rs RedisSettings) Hosts {
 | 
				
			|||||||
	fileHosts := &FileHosts{hs.HostsFile}
 | 
						fileHosts := &FileHosts{hs.HostsFile}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var rc *redis.Client
 | 
						var rc *redis.Client
 | 
				
			||||||
	if rs.Enable {
 | 
						if hs.RedisEnable {
 | 
				
			||||||
		rc = &redis.Client{Addr: rs.Addr(), Db: rs.DB, Password: rs.Password}
 | 
							rc = &redis.Client{Addr: rs.Addr(), Db: rs.DB, Password: rs.Password}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		rc = nil
 | 
							rc = nil
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,6 @@ type DNSServerSettings struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RedisSettings struct {
 | 
					type RedisSettings struct {
 | 
				
			||||||
	Enable   bool
 | 
					 | 
				
			||||||
	Host     string
 | 
						Host     string
 | 
				
			||||||
	Port     int
 | 
						Port     int
 | 
				
			||||||
	DB       int
 | 
						DB       int
 | 
				
			||||||
@ -60,6 +59,7 @@ type CacheSettings struct {
 | 
				
			|||||||
type HostsSettings struct {
 | 
					type HostsSettings struct {
 | 
				
			||||||
	Enable      bool
 | 
						Enable      bool
 | 
				
			||||||
	HostsFile   string `toml:"host-file"`
 | 
						HostsFile   string `toml:"host-file"`
 | 
				
			||||||
 | 
						RedisEnable bool   `toml:"redis-enable"`
 | 
				
			||||||
	RedisKey    string `toml:"redis-key"`
 | 
						RedisKey    string `toml:"redis-key"`
 | 
				
			||||||
	TTL         uint32 `toml:"ttl"`
 | 
						TTL         uint32 `toml:"ttl"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user