include os and arch in
This commit is contained in:
@ -200,10 +200,10 @@ func (cc *ClientConfig) CopyExecutable() error {
|
||||
}
|
||||
|
||||
func (cc *ClientConfig) Load() error {
|
||||
if _, err := os.Stat("client.yaml"); os.IsNotExist(err) {
|
||||
if _, err := os.Stat(clientFile()); os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
yamlFile, err := ioutil.ReadFile("client.yaml")
|
||||
yamlFile, err := ioutil.ReadFile(clientFile())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -215,7 +215,7 @@ func (cc *ClientConfig) Save() error {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
return ioutil.WriteFile("client.yaml", bytes, 0644)
|
||||
return ioutil.WriteFile(clientFile(), bytes, 0644)
|
||||
}
|
||||
|
||||
func find(root, ext string) []string {
|
||||
@ -235,3 +235,16 @@ func find(root, ext string) []string {
|
||||
func Copy(src, dst string) error {
|
||||
return copy.Copy(src, dst)
|
||||
}
|
||||
|
||||
func clientFile() string {
|
||||
goos := os.Getenv("GOOS")
|
||||
goarch := os.Getenv("GOARCH")
|
||||
r := "client"
|
||||
if goos != "" {
|
||||
r += "-" + goos
|
||||
}
|
||||
if goarch != "" {
|
||||
r += "-" + goarch
|
||||
}
|
||||
return r + ".yaml"
|
||||
}
|
||||
|
@ -301,10 +301,10 @@ func (pc *PluginConfig) keysPath(path string) (string, error) {
|
||||
}
|
||||
|
||||
func (cc *PluginConfig) Load() error {
|
||||
if _, err := os.Stat("plugin.yaml"); os.IsNotExist(err) {
|
||||
if _, err := os.Stat(pluginFile()); os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
yamlFile, err := ioutil.ReadFile("plugin.yaml")
|
||||
yamlFile, err := ioutil.ReadFile(pluginFile())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -316,5 +316,18 @@ func (pc *PluginConfig) Save() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
ioutil.WriteFile("plugin.yaml", bytes, 0644)
|
||||
ioutil.WriteFile(pluginFile(), bytes, 0644)
|
||||
}
|
||||
|
||||
func pluginFile() string {
|
||||
goos := os.Getenv("GOOS")
|
||||
goarch := os.Getenv("GOARCH")
|
||||
r := "plugin"
|
||||
if goos != "" {
|
||||
r += "-" + goos
|
||||
}
|
||||
if goarch != "" {
|
||||
r += "-" + goarch
|
||||
}
|
||||
return r + ".yaml"
|
||||
}
|
||||
|
Reference in New Issue
Block a user