mirror of
				https://github.com/onyx-and-iris/q3rcon-proxy.git
				synced 2025-10-31 12:51:50 +00:00 
			
		
		
		
	Q3RCON_DEBUG env var added
This commit is contained in:
		
							parent
							
								
									7138515904
								
							
						
					
					
						commit
						94a683fb3f
					
				| @ -2,10 +2,12 @@ package main | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"log" | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	log "github.com/sirupsen/logrus" | ||||
| 
 | ||||
| 	"github.com/onyx-and-iris/q3rcon-proxy/pkg/udpproxy" | ||||
| ) | ||||
| 
 | ||||
| @ -26,9 +28,21 @@ func start(proxy string) { | ||||
| } | ||||
| 
 | ||||
| var ( | ||||
| 	proxies, host string | ||||
| 	proxies, host, debug string | ||||
| ) | ||||
| 
 | ||||
| func getenvInt(key string) (int, error) { | ||||
| 	s := os.Getenv(key) | ||||
| 	if s == "" { | ||||
| 		return 0, nil | ||||
| 	} | ||||
| 	v, err := strconv.Atoi(s) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 	return v, nil | ||||
| } | ||||
| 
 | ||||
| func init() { | ||||
| 	proxies = os.Getenv("Q3RCON_PROXY") | ||||
| 	if proxies == "" { | ||||
| @ -39,6 +53,18 @@ func init() { | ||||
| 	if host == "" { | ||||
| 		host = "0.0.0.0" | ||||
| 	} | ||||
| 
 | ||||
| 	debug, err := getenvInt("Q3RCON_DEBUG") | ||||
| 	if err != nil { | ||||
| 		log.Fatal(err) | ||||
| 	} | ||||
| 
 | ||||
| 	if debug == 1 { | ||||
| 		log.SetLevel(log.DebugLevel) | ||||
| 	} else { | ||||
| 		log.SetLevel(log.InfoLevel) | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| func main() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user