in init/fluent_bit_init_process.go [156:189]
func getAllConfigFiles() {
// get all env vars in the container
envs := os.Environ()
// find all env vars match specified prefix
for _, env := range envs {
var envKey string
var envValue string
env_kv := strings.SplitN(env, "=", 2)
if len(env_kv) != 2 {
logrus.Fatalf("[FluentBit Init Process] Unrecognizable environment variables: %s\n", env)
}
envKey = string(env_kv[0])
envValue = string(env_kv[1])
s3_regex, _ := regexp.Compile("aws_fluent_bit_init_[sS]3")
file_regex, _ := regexp.Compile("aws_fluent_bit_init_[fF]ile")
matched_s3 := s3_regex.MatchString(envKey)
matched_file := file_regex.MatchString(envKey)
// if this env var's value is an arn, download the config file first, then process it
if matched_s3 {
s3FilePath := getS3ConfigFile(envValue)
s3FileName := strings.SplitN(s3FilePath, "/", -1)
processConfigFile(s3FileDirectoryPath + s3FileName[len(s3FileName)-1])
}
// if this env var's value is a path of our built-in config file, process is derectly
if matched_file {
processConfigFile(envValue)
}
}
}