refactor: unify property function implementations
Rather than reimplementing the property functions in two different languages - and potentially having compatibility issues - standardize on golang for the implementation through the use of a generated binary. This also implements all the list functions for use with shell-based plugins. Note that the interface to the prop binary is experimental, and it should not be used directly.
This commit is contained in:
@@ -262,6 +262,15 @@ func MustGetEnv(key string) (val string) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetenvWithDefault returns env variable or defaultValue if it's not set
|
||||
func GetenvWithDefault(key string, defaultValue string) (val string) {
|
||||
val = os.Getenv(key)
|
||||
if val == "" {
|
||||
val = defaultValue
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ReadFirstLine gets the first line of a file that has contents and returns it
|
||||
// if there are no contents, an empty string is returned
|
||||
// will also return an empty string if the file does not exist
|
||||
|
||||
Reference in New Issue
Block a user