From 0ffda7b529640f2e04d3c09abe69a57f810e3658 Mon Sep 17 00:00:00 2001 From: Jared Lunde Date: Tue, 21 May 2024 20:42:24 -0700 Subject: [PATCH] fix: fix runtime arg --- cmd/new-dockerfile/main.go | 19 ++++++++++++++----- node/package.json | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cmd/new-dockerfile/main.go b/cmd/new-dockerfile/main.go index 79ddc16..16d3b17 100644 --- a/cmd/new-dockerfile/main.go +++ b/cmd/new-dockerfile/main.go @@ -3,13 +3,14 @@ package main import ( "errors" "fmt" - "github.com/spf13/viper" "log/slog" "os" "path/filepath" "strings" "time" + "github.com/spf13/viper" + dockerfile "github.com/flexstack/new-dockerfile" "github.com/flexstack/new-dockerfile/runtime" "github.com/lmittmann/tint" @@ -49,9 +50,18 @@ func main() { viper.SetConfigType("yaml") viper.SetConfigType("yml") viper.AddConfigPath(".") - if err := viper.ReadInConfig(); err != nil && !errors.As(err, &viper.ConfigFileNotFoundError{}) { - log.Error("Fatal error: " + err.Error()) - os.Exit(1) + configExists := true + if err := viper.ReadInConfig(); err != nil { + if !errors.As(err, &viper.ConfigFileNotFoundError{}) { + log.Error("Fatal error: " + err.Error()) + os.Exit(1) + } + + configExists = false + } + + if configExists { + runtimeArg = viper.GetString("runtime") } var ( @@ -59,7 +69,6 @@ func main() { err error ) - runtimeArg = viper.GetString("runtime") if runtimeArg != "" { runtimes := df.ListRuntimes() diff --git a/node/package.json b/node/package.json index 5e6ff2c..1d19e10 100644 --- a/node/package.json +++ b/node/package.json @@ -1,8 +1,8 @@ { "name": "new-dockerfile", - "version": "0.3.0", + "version": "0.3.1", "config": { - "bin_version": "0.3.0" + "bin_version": "0.3.1" }, "description": "Autogenerate Dockerfiles from your project source code", "main": "index.js",