mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Allow to set daemon and server configurations in a file.
Read configuration after flags making this the priority: 1- Apply configuration from file. 2- Apply configuration from flags. Reload configuration when a signal is received, USR2 in Linux: - Reload router if the debug configuration changes. - Reload daemon labels. - Reload cluster discovery. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
		
							parent
							
								
									22a81a2c58
								
							
						
					
					
						commit
						677a6b3506
					
				
					 23 changed files with 1218 additions and 128 deletions
				
			
		
							
								
								
									
										26
									
								
								utils/debug.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								utils/debug.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
package utils
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"github.com/Sirupsen/logrus"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EnableDebug sets the DEBUG env var to true
 | 
			
		||||
// and makes the logger to log at debug level.
 | 
			
		||||
func EnableDebug() {
 | 
			
		||||
	os.Setenv("DEBUG", "1")
 | 
			
		||||
	logrus.SetLevel(logrus.DebugLevel)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DisableDebug sets the DEBUG env var to false
 | 
			
		||||
// and makes the logger to log at info level.
 | 
			
		||||
func DisableDebug() {
 | 
			
		||||
	os.Setenv("DEBUG", "")
 | 
			
		||||
	logrus.SetLevel(logrus.InfoLevel)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IsDebugEnabled checks whether the debug flag is set or not.
 | 
			
		||||
func IsDebugEnabled() bool {
 | 
			
		||||
	return os.Getenv("DEBUG") != ""
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue