mirror of
				https://github.com/taigrr/godns
				synced 2025-01-18 04:03:25 -08:00 
			
		
		
		
	refactor run with docker logic
This commit is contained in:
		
							parent
							
								
									ef3faafca7
								
							
						
					
					
						commit
						c302352cc9
					
				| @ -1,4 +1,4 @@ | |||||||
| FROM alpine:latest | FROM timothyye/alpine:3.6-glibc | ||||||
| MAINTAINER Timothy | MAINTAINER Timothy | ||||||
| RUN apk add --update ca-certificates | RUN apk add --update ca-certificates | ||||||
| RUN mkdir -p /usr/local/godns | RUN mkdir -p /usr/local/godns | ||||||
| @ -6,4 +6,4 @@ COPY godns /usr/local/godns | |||||||
| RUN chmod +x /usr/local/godns/godns | RUN chmod +x /usr/local/godns/godns | ||||||
| RUN rm -rf /var/cache/apk/* | RUN rm -rf /var/cache/apk/* | ||||||
| WORKDIR /usr/local/godns | WORKDIR /usr/local/godns | ||||||
| ENTRYPOINT ["./godns", "-d"] | ENTRYPOINT ["./godns", "-c", "/usr/local/godns/config.json"] | ||||||
|  | |||||||
							
								
								
									
										30
									
								
								godns.go
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								godns.go
									
									
									
									
									
								
							| @ -20,7 +20,6 @@ const ( | |||||||
| var ( | var ( | ||||||
| 	configuration Settings | 	configuration Settings | ||||||
| 	optConf       = flag.String("c", "./config.json", "Specify a config file") | 	optConf       = flag.String("c", "./config.json", "Specify a config file") | ||||||
| 	optDocker     = flag.Bool("d", false, "Run it as docker mode") |  | ||||||
| 	optHelp       = flag.Bool("h", false, "Show help") | 	optHelp       = flag.Bool("h", false, "Show help") | ||||||
| 	panicCount    = 0 | 	panicCount    = 0 | ||||||
| ) | ) | ||||||
| @ -32,30 +31,11 @@ func main() { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if *optDocker { | 	//Load settings from configurations file | ||||||
| 		// Load settings from ENV | 	if err := LoadSettings(*optConf, &configuration); err != nil { | ||||||
| 		configuration = Settings{ | 		fmt.Println(err.Error()) | ||||||
| 			Email:      os.Getenv("EMAIL"), | 		log.Println(err.Error()) | ||||||
| 			Password:   os.Getenv("PASSWORD"), | 		os.Exit(1) | ||||||
| 			LoginToken: os.Getenv("TOKEN"), |  | ||||||
| 			IPUrl:      "http://members.3322.org/dyndns/getip", |  | ||||||
| 			LogPath:    "./godns.log", |  | ||||||
| 			LogSize:    16, |  | ||||||
| 			LogNum:     3, |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if err := LoadDomains(os.Getenv("DOMAINS"), &configuration.Domains); err != nil { |  | ||||||
| 			fmt.Println(err.Error()) |  | ||||||
| 			log.Println(err.Error()) |  | ||||||
| 			os.Exit(1) |  | ||||||
| 		} |  | ||||||
| 	} else { |  | ||||||
| 		//Load settings from configurations file |  | ||||||
| 		if err := LoadSettings(*optConf, &configuration); err != nil { |  | ||||||
| 			fmt.Println(err.Error()) |  | ||||||
| 			log.Println(err.Error()) |  | ||||||
| 			os.Exit(1) |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if err := checkSettings(&configuration); err != nil { | 	if err := checkSettings(&configuration); err != nil { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user