session: process environment.d and allow empty variables

1. All '*.env' files in an 'environment.d' directory alongside each
   potential 'environment' file will be parsed and added to the
   environment.

2. For the purposes of configuration merging, an environment definition
   exists at one level if either the 'environment' file is defined or
   its corresponding 'environment.d' contains any valid '*.env' file.

3. Variable declarations of the form "VARIABLE=", with no following
   value, will be written to the environment as empty strings.
This commit is contained in:
Andrew J. Hesford 2024-03-09 12:03:30 -05:00 committed by Johan Malm
parent 52cb643189
commit e837445114
4 changed files with 121 additions and 10 deletions

View file

@ -59,7 +59,18 @@ char *strdup_printf(const char *fmt, ...);
* The separator is arbitrary. When the separator is NULL, a single space will
* be used.
*/
char *str_join(const char * const parts[],
char *str_join(const char *const parts[],
const char *restrict fmt, const char *restrict sep);
/**
* str_endswith - indicate whether a string ends with a given suffix
* @string: string to test
* @suffix: suffix to expect in string
*
* If suffix is "" or NULL, this method always returns true; otherwise, this
* method returns true if and only if the full suffix exists at the end of the
* string.
*/
bool str_endswith(const char *const string, const char *const suffix);
#endif /* LABWC_STRING_HELPERS_H */