|
@@ -18,7 +18,8 @@ type runtimeInfo struct {
|
|
|
LastBrowserUserAgent string
|
|
LastBrowserUserAgent string
|
|
|
User string
|
|
User string
|
|
|
Uid string
|
|
Uid string
|
|
|
- FoundSshKey string
|
|
|
|
|
|
|
+ SshFoundKey string
|
|
|
|
|
+ SshFoundConfig string
|
|
|
AvailableVersion string
|
|
AvailableVersion string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -29,20 +30,26 @@ var Runtime = &runtimeInfo{
|
|
|
OSReleasePrettyName: getOsReleasePrettyName(),
|
|
OSReleasePrettyName: getOsReleasePrettyName(),
|
|
|
User: os.Getenv("USER"),
|
|
User: os.Getenv("USER"),
|
|
|
Uid: os.Getenv("UID"),
|
|
Uid: os.Getenv("UID"),
|
|
|
|
|
+ SshFoundKey: searchForSshKey(),
|
|
|
|
|
+ SshFoundConfig: searchForSshConfig(),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func refreshRuntimeInfo() {
|
|
|
|
|
- Runtime.FoundSshKey = searchForSshKey()
|
|
|
|
|
|
|
+func searchForSshKey() string {
|
|
|
|
|
+ return searchForHomeFile(".ssh/id_rsa")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func searchForSshKey() string {
|
|
|
|
|
- path, _ := filepath.Abs(path.Join(os.Getenv("HOME"), ".ssh/id_rsa"))
|
|
|
|
|
|
|
+func searchForSshConfig() string {
|
|
|
|
|
+ return searchForHomeFile(".ssh/config")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func searchForHomeFile(file string) string {
|
|
|
|
|
+ path, _ := filepath.Abs(path.Join(os.Getenv("HOME"), file))
|
|
|
|
|
|
|
|
if _, err := os.Stat(path); err == nil {
|
|
if _, err := os.Stat(path); err == nil {
|
|
|
return path
|
|
return path
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return "none-found at " + path
|
|
|
|
|
|
|
+ return "not found at " + path
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func isInContainer() bool {
|
|
func isInContainer() bool {
|