func initStorage(engineType storage.EngineType) (storage.Engine, error) {

	config, err := config.FromEnv()
	if err != nil {
		return nil, err
	}

	switch engineType {
	case storage.BoltEngine:

		boltStorageEngine, err := bolt.Init(config.Database.Bolt)
		if err != nil {
			return nil, err
		}

		return &boltStorageEngine, nil
	case storage.RedisEngine:
		redisStorageEngine, err := redis.Init(config.Database.Redis)
		if err != nil {
			return nil, err
		}
		return &redisStorageEngine, nil
	default:
		return nil, fmt.Errorf("storage backend not implemented: %s", engineType)
	}
}
// initStorage creates a storage object with the appropriate engine
initStorage creates a storage object with the appropriate engine
// initStorage creates a storage object with the appropriate engine
func initStorage(engineType storage.EngineType) (storage.Engine, error) {
	config, err := config.FromEnv()
	if err != nil {
		return nil, err
	}
	switch engineType {
	case storage.BoltEngine:
		boltStorageEngine, err := bolt.Init(config.Database.Bolt)
		if err != nil {
			return nil, err
		}
		return &boltStorageEngine, nil
	case storage.RedisEngine:
		redisStorageEngine, err := redis.Init(config.Database.Redis)
		if err != nil {
			return nil, err
		}
		return &redisStorageEngine, nil
	default:
		return nil, fmt.Errorf("storage backend not implemented: %s", engineType)
	}
}
func initStorage ( engineType storage . EngineType ) ( storage . Engine , error ) { config , err := config . FromEnv ( ) if err != nil { return nil , err } switch engineType { case storage . BoltEngine : boltStorageEngine , err := bolt . Init ( config . Database . Bolt ) if err != nil { return nil , err } return & boltStorageEngine , nil case storage . RedisEngine : redisStorageEngine , err := redis . Init ( config . Database . Redis ) if err != nil { return nil , err } return & redisStorageEngine , nil default : return nil , fmt . Errorf ( " " , engineType ) } }
initStorage creates a storage object with the appropriate engine
initStorage creates a storage object with the appropriate engine