remove support for environment paths

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-05-12 17:12:40 -07:00
parent b77d1a1e3e
commit 5442d6b261

View File

@ -2,8 +2,6 @@ package common
import ( import (
"context" "context"
"errors"
"os"
"dagger.io/go/dagger" "dagger.io/go/dagger"
"dagger.io/go/dagger/state" "dagger.io/go/dagger/state"
@ -14,7 +12,7 @@ import (
func GetCurrentEnvironmentState(ctx context.Context) *state.State { func GetCurrentEnvironmentState(ctx context.Context) *state.State {
lg := log.Ctx(ctx) lg := log.Ctx(ctx)
// 1) If no environment name has been given, look for the current environment // If no environment name has been given, look for the current environment
environment := viper.GetString("environment") environment := viper.GetString("environment")
if environment == "" { if environment == "" {
st, err := state.Current(ctx) st, err := state.Current(ctx)
@ -27,21 +25,9 @@ func GetCurrentEnvironmentState(ctx context.Context) *state.State {
return st return st
} }
// 2) Check if it's an environment path (can be opened directly)
st, err := state.Open(ctx, environment)
if err == nil {
return st
}
if !errors.Is(err, os.ErrNotExist) {
lg.
Fatal().
Err(err).
Str("environmentPath", environment).
Msg("failed to load environment")
}
// At this point, it must be an environment name // At this point, it must be an environment name
workspace := viper.GetString("workspace") workspace := viper.GetString("workspace")
var err error
if workspace == "" { if workspace == "" {
workspace, err = state.CurrentWorkspace(ctx) workspace, err = state.CurrentWorkspace(ctx)
if err != nil { if err != nil {