mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Transform Listen statement to new format if needed
This commit is contained in:
		
							parent
							
								
									c99ed9fb60
								
							
						
					
					
						commit
						bbb35d7209
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -74,6 +74,12 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
 | 
				
			||||||
	if err := hjson.Unmarshal(conf, &dat); err != nil {
 | 
						if err := hjson.Unmarshal(conf, &dat); err != nil {
 | 
				
			||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// Check for fields that have changed type recently, e.g. the Listen config
 | 
				
			||||||
 | 
						// option is now a []string rather than a string
 | 
				
			||||||
 | 
						if listen, ok := dat["Listen"].(string); ok {
 | 
				
			||||||
 | 
							dat["Listen"] = []string{listen}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// Sanitise the config
 | 
				
			||||||
	confJson, err := json.Marshal(dat)
 | 
						confJson, err := json.Marshal(dat)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue