// Sanitize sets default values to empty configuration variables, if it's possible.
Sanitize sets default values to empty configuration variables, if it's possible.
// Sanitize sets default values to empty configuration variables if it ' s possible .
func (s *Engine) Sanitize() error {
	if s.Name == "" {
		s.Name = DefaultStorageEngine
	}
	if s.Implementation == nil {
		switch s.Name {
		case DefaultStorageEngine:
			s.Implementation = &kvstore.KVStore{}
			s.Config = kvstore.DefaultConfig().ToMap()
		default:
			return fmt.Errorf("unknown storage engine: %s", s.Name)
		}
	} else {
		s.Name = s.Implementation.Name()
	}
	return nil
}
func ( s * Engine ) Sanitize ( ) error { if s . Name == " " { s . Name = DefaultStorageEngine } if s . Implementation == nil { switch s . Name { case DefaultStorageEngine : s . Implementation = & kvstore . KVStore { } s . Config = kvstore . DefaultConfig ( ) . ToMap ( ) default : return fmt . Errorf ( " " , s . Name ) } } else { s . Name = s . Implementation . Name ( ) } return nil }
Sanitize sets default values to empty configuration variables, if it's possible.
Sanitize sets default values to empty configuration variables if it ' s possible .