mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	config: use configured reader by default (#1717)
This commit is contained in:
		
				
					committed by
					
						 Dominic Wong
						Dominic Wong
					
				
			
			
				
	
			
			
			
						parent
						
							81aa8e0231
						
					
				
				
					commit
					aef6878ee0
				
			| @@ -41,7 +41,6 @@ func newConfig(opts ...Option) (Config, error) { | ||||
|  | ||||
| func (c *config) Init(opts ...Option) error { | ||||
| 	c.opts = Options{ | ||||
| 		Loader: memory.NewLoader(), | ||||
| 		Reader: json.NewReader(), | ||||
| 	} | ||||
| 	c.exit = make(chan bool) | ||||
| @@ -49,6 +48,11 @@ func (c *config) Init(opts ...Option) error { | ||||
| 		o(&c.opts) | ||||
| 	} | ||||
|  | ||||
| 	// default loader uses the configured reader | ||||
| 	if c.opts.Loader == nil { | ||||
| 		c.opts.Loader = memory.NewLoader(memory.WithReader(c.opts.Reader)) | ||||
| 	} | ||||
|  | ||||
| 	err := c.opts.Loader.Load(c.opts.Source...) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user