Skip to content

Commit 0ffda7b

Browse files
committed
fix: fix runtime arg
1 parent 4d58946 commit 0ffda7b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

cmd/new-dockerfile/main.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package main
33
import (
44
"errors"
55
"fmt"
6-
"github.com/spf13/viper"
76
"log/slog"
87
"os"
98
"path/filepath"
109
"strings"
1110
"time"
1211

12+
"github.com/spf13/viper"
13+
1314
dockerfile "github.com/flexstack/new-dockerfile"
1415
"github.com/flexstack/new-dockerfile/runtime"
1516
"github.com/lmittmann/tint"
@@ -49,17 +50,25 @@ func main() {
4950
viper.SetConfigType("yaml")
5051
viper.SetConfigType("yml")
5152
viper.AddConfigPath(".")
52-
if err := viper.ReadInConfig(); err != nil && !errors.As(err, &viper.ConfigFileNotFoundError{}) {
53-
log.Error("Fatal error: " + err.Error())
54-
os.Exit(1)
53+
configExists := true
54+
if err := viper.ReadInConfig(); err != nil {
55+
if !errors.As(err, &viper.ConfigFileNotFoundError{}) {
56+
log.Error("Fatal error: " + err.Error())
57+
os.Exit(1)
58+
}
59+
60+
configExists = false
61+
}
62+
63+
if configExists {
64+
runtimeArg = viper.GetString("runtime")
5565
}
5666

5767
var (
5868
r runtime.Runtime
5969
err error
6070
)
6171

62-
runtimeArg = viper.GetString("runtime")
6372
if runtimeArg != "" {
6473
runtimes := df.ListRuntimes()
6574

node/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "new-dockerfile",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"config": {
5-
"bin_version": "0.3.0"
5+
"bin_version": "0.3.1"
66
},
77
"description": "Autogenerate Dockerfiles from your project source code",
88
"main": "index.js",

0 commit comments

Comments
 (0)