22 lines
393 B
Go
22 lines
393 B
Go
|
package config
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// FromEnv analyzes all the environment variables to find each one
|
||
|
// starting by GUSTUS_
|
||
|
func (c *Config) FromEnv() error {
|
||
|
for _, line := range os.Environ() {
|
||
|
if strings.HasPrefix(line, "IDFM_") {
|
||
|
err := c.parseLine(line)
|
||
|
if err != nil {
|
||
|
return fmt.Errorf("error in environment (%q): %w", line, err)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|