Skip to content

Commit 116c67b

Browse files
authored
Merge pull request #7 from yogin/gosh
New gosh cli to replace ec2
2 parents 00950b2 + 6b3e14b commit 116c67b

File tree

14 files changed

+1236
-4
lines changed

14 files changed

+1236
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616

1717
.DS_Store
1818
ec2
19+
.gosh.yaml*
20+
.gosh.yml*
21+
.gosh.json*

cmd/gosh/main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
8+
"github.com/yogin/go-ec2/internal/config"
9+
"github.com/yogin/go-ec2/internal/service"
10+
)
11+
12+
func main() {
13+
configPath := flag.String("c", "", "Configuration file path")
14+
flag.Parse()
15+
16+
cfg := config.NewConfig(configPath)
17+
18+
service := service.NewService(cfg)
19+
if err := service.Run(); err != nil {
20+
fmt.Printf("error: %s\n", err)
21+
os.Exit(1)
22+
}
23+
}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ go 1.13
44

55
require (
66
github.com/aws/aws-sdk-go v1.29.18
7-
github.com/gdamore/tcell/v2 v2.2.0
7+
github.com/gdamore/tcell/v2 v2.7.4
88
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
9-
github.com/rivo/tview v0.0.0-20210217110421-8a8f78a6dd01
10-
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04 // indirect
11-
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
9+
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1
10+
golang.org/x/term v0.18.0 // indirect
11+
gopkg.in/yaml.v3 v3.0.1 // indirect
1212
)

go.sum

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo
77
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
88
github.com/gdamore/tcell/v2 v2.2.0 h1:vSyEgKwraXPSOkvCk7IwOSyX+Pv3V2cV9CikJMXg4U4=
99
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
10+
github.com/gdamore/tcell/v2 v2.7.1/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg=
11+
github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU=
12+
github.com/gdamore/tcell/v2 v2.7.4/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg=
1013
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
1114
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
1215
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
@@ -17,37 +20,80 @@ github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i
1720
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
1821
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
1922
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
23+
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
24+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
2025
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2126
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2227
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2328
github.com/rivo/tview v0.0.0-20210217110421-8a8f78a6dd01 h1:rtCzDXdaqhiRakJsz0bUj+3sOUjw82bJDcJrAzQ0u+M=
2429
github.com/rivo/tview v0.0.0-20210217110421-8a8f78a6dd01/go.mod h1:n2q/ydglZJ1kqxiNrnYO+FaX1H14vA0wKyIo953QakU=
30+
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1 h1:bWLHTRekAy497pE7+nXSuzXwwFHI0XauRzz6roUvY+s=
31+
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss=
2532
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
2633
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
2734
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
2835
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
36+
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
37+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
38+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
2939
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
3040
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
3141
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
42+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
3243
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
44+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
45+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
46+
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
47+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
3348
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
3449
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
50+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
51+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
52+
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
53+
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
54+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
55+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
56+
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3557
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3658
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3759
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
3860
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3961
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
4062
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04 h1:cEhElsAv9LUt9ZUUocxzWe05oFLVd+AA2nstydTeI8g=
4163
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
64+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
65+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
66+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
67+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
68+
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
69+
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
70+
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
71+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
4272
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
4373
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
4474
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
4575
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
76+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
77+
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
78+
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
79+
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
80+
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
4681
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
82+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4783
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
4884
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
85+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
86+
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
87+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
88+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
4989
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
90+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
91+
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
92+
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
93+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5094
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5195
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5296
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
5397
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
98+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
99+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/config/config.go

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
package config
2+
3+
import (
4+
"encoding/json"
5+
"errors"
6+
"fmt"
7+
"os"
8+
"path/filepath"
9+
"strings"
10+
11+
"github.com/yogin/go-ec2/internal/utils"
12+
"gopkg.in/yaml.v3"
13+
)
14+
15+
const (
16+
DefaultConfigFile = "gosh.yaml" // DefaultConfigFile is the default configuration file name
17+
CurrentConfigVersion = 1 // CurrentConfigVersion is the current configuration version
18+
DefaultTimeFormat = "2006-01-02 15:04:05" // DefaultTimeFormat is the default time format
19+
)
20+
21+
var (
22+
config *Config // config is the global configuration
23+
)
24+
25+
type Config struct {
26+
Version int `json:"version" yaml:"version"`
27+
Profiles []*Profile `json:"profiles" yaml:"profiles"`
28+
ShowUTCTime bool `json:"show_utc_time" yaml:"show_utc_time"` // show UTC time (default: false)
29+
ShowLocalTime bool `json:"show_local_time" yaml:"show_local_time"` // show local time (default: false)
30+
TimeFormat string `json:"time_format" yaml:"time_format"` // time format (default: "2006-01-02 15:04:05")
31+
32+
configPath string
33+
}
34+
35+
type Profile struct {
36+
ID string `json:"id" yaml:"id"` // profile id (unique, used for navigation)
37+
Provider string `json:"provider" yaml:"provider"` // aws, gcp, azure (only aws is supported for now)
38+
Name string `json:"name" yaml:"name"` // provider profile name (eg. aws profile name)
39+
Region string `json:"region" yaml:"region"` // region (us-west-1, us-east-1, etc)
40+
PreferPublicIP bool `json:"prefer_public_ip" yaml:"prefer_public_ip"` // prefer public IP over private IP (default: false)
41+
Refresh Refresh `json:"refresh" yaml:"refresh"` // auto refresh settings
42+
}
43+
44+
type Refresh struct {
45+
Enabled bool `json:"enabled" yaml:"enabled"` // auto refresh enabled (default: false)
46+
Interval int `json:"interval" yaml:"interval"` // refresh interval in seconds (default: 60)
47+
}
48+
49+
func NewConfig(path *string) *Config {
50+
if config != nil {
51+
return config
52+
}
53+
54+
config = DefaultConfiguration()
55+
56+
if path != nil {
57+
config.configPath = *path
58+
}
59+
60+
if config.findConfigFile() {
61+
config.Profiles = make([]*Profile, 0) // reset default profiles if configuration file is found
62+
63+
if err := config.loadConfigFile(); err != nil {
64+
fmt.Printf("error: %s\n", err)
65+
os.Exit(1)
66+
}
67+
}
68+
69+
return config
70+
}
71+
72+
func (c *Config) Save() error {
73+
data, err := yaml.Marshal(c)
74+
if err != nil {
75+
return err
76+
}
77+
78+
if len(c.configPath) == 0 {
79+
home, err := os.UserHomeDir()
80+
if err != nil {
81+
return err
82+
}
83+
84+
c.configPath = filepath.Join(home, fmt.Sprintf(".%s", DefaultConfigFile))
85+
}
86+
87+
err = os.WriteFile(c.configPath, data, 0644)
88+
return err
89+
}
90+
91+
func (c *Config) ConfigPath() string {
92+
return c.configPath
93+
}
94+
95+
func DefaultConfiguration() *Config {
96+
profile := Profile{
97+
ID: "default",
98+
Provider: "aws",
99+
Name: "default",
100+
Refresh: Refresh{Enabled: true, Interval: 60},
101+
}
102+
103+
return &Config{
104+
Version: CurrentConfigVersion,
105+
Profiles: []*Profile{&profile},
106+
ShowUTCTime: true,
107+
ShowLocalTime: true,
108+
TimeFormat: DefaultTimeFormat,
109+
}
110+
}
111+
112+
func (c *Config) loadYAMLConfigFile() error {
113+
data, err := os.ReadFile(c.configPath)
114+
if err != nil {
115+
return err
116+
}
117+
118+
if err = yaml.Unmarshal(data, c); err != nil {
119+
return err
120+
}
121+
122+
return nil
123+
}
124+
125+
func (c *Config) loadJSONConfigFile() error {
126+
data, err := os.ReadFile(c.configPath)
127+
if err != nil {
128+
return err
129+
}
130+
131+
if err = json.Unmarshal(data, c); err != nil {
132+
return err
133+
}
134+
135+
return nil
136+
}
137+
138+
func (c *Config) loadConfigFile() error {
139+
// try to load yaml configuration file
140+
if strings.HasSuffix(c.configPath, ".yaml") || strings.HasSuffix(c.configPath, ".yml") {
141+
return c.loadYAMLConfigFile()
142+
}
143+
144+
// try to load json configuration file
145+
if strings.HasSuffix(c.configPath, ".json") {
146+
return c.loadJSONConfigFile()
147+
}
148+
149+
return errors.New("unsupported configuration file format")
150+
}
151+
152+
func (c *Config) findConfigFile() bool {
153+
// if the configuration file is provided and exists, use it
154+
if len(c.configPath) > 0 && utils.IsFile(c.configPath) {
155+
return true
156+
}
157+
158+
// if not found, check for configuration file in the current directory
159+
if path := fmt.Sprintf(".%s", DefaultConfigFile); utils.IsFile(path) {
160+
c.configPath = path
161+
return true
162+
}
163+
164+
// if not found, check for configuration file in the home directory
165+
if home, err := os.UserHomeDir(); err == nil {
166+
if path := filepath.Join(home, fmt.Sprintf(".%s", DefaultConfigFile)); utils.IsFile(path) {
167+
c.configPath = path
168+
return true
169+
}
170+
}
171+
172+
// if not found, check for global configuration file
173+
if utils.IsDirectory("/etc") {
174+
if path := fmt.Sprintf("/etc/%s", DefaultConfigFile); utils.IsFile(path) {
175+
c.configPath = path
176+
return true
177+
}
178+
}
179+
180+
return false
181+
}

0 commit comments

Comments
 (0)