File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,14 @@ package main
33import (
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
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments