diff --git a/internal/system/system.go b/internal/system/system.go index a694403..079ab47 100644 --- a/internal/system/system.go +++ b/internal/system/system.go @@ -12,12 +12,14 @@ import ( ) +// GetUptimeInSeconds: Returns a value (as string) of the total system uptime func GetUptimeInSeconds() string { uptime, _ := host.Uptime() return strconv.FormatUint(uptime, 10) } +// GetUptimeFormatted: Returns a humanized version that can be useful for logging func GetUptimeFormatted() string { uptime, _ := host.Uptime() @@ -27,6 +29,7 @@ func GetUptimeFormatted() string { return fmt.Sprintf("%d days, %d hours, %d minutes", days, hours, minutes) } +// GetIP: Returns the ip address of the instance func GetIP() string { ip := "" @@ -57,6 +60,7 @@ func GetHostname() string { return utils.Exec("/", "hostname", []string{}) } +// SetupCloudOptions: Reads the designated env file looking for options to write into the options table. Meant to be used on initial setup. Deletes source env file after operation. func SetupCloudOptions() { var cloudEnv map[string]string diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 3726bf2..2eeaa35 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -163,6 +163,7 @@ func GetPath(pathKey string) string { } +// WriteOption : Writes a key value pair option into the api shared database func WriteOption(optionKey string, optionValue string) { db, err := sql.Open("sqlite3", GetSQLiteDbConnectionDetails())