mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-24 08:12:38 +02:00
Fix loading environment variables from the AWS System Manager Parameter Store when there are more than 10 parameters
This commit is contained in:
parent
6a96d07d5a
commit
7d2b61e63b
@ -5,6 +5,7 @@
|
||||
- Support configuring OpenTelemetry with standard [general](https://opentelemetry.io/docs/languages/sdk-configuration/general/) and [OTLP Exporter](https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/) environment variables.
|
||||
|
||||
### Fix
|
||||
- Fix loading environment variables from the AWS System Manager Parameter Store when there are more than 10 parameters.
|
||||
- (pro) Fixed thumbnail generation for MKV/WebM files containing blocks invalidly marked as keyframes.
|
||||
|
||||
### Deprecated
|
||||
|
@ -86,34 +86,43 @@ func loadAWSSystemManagerParams() error {
|
||||
|
||||
svc := ssm.New(sess, conf)
|
||||
|
||||
input := ssm.GetParametersByPathInput{
|
||||
Path: aws.String(paramsPath),
|
||||
WithDecryption: aws.Bool(true),
|
||||
}
|
||||
var nextToken *string
|
||||
|
||||
output, err := svc.GetParametersByPath(&input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't retrieve parameters from AWS SSM: %s", err)
|
||||
}
|
||||
|
||||
for _, p := range output.Parameters {
|
||||
if p == nil || p.Name == nil || p.Value == nil {
|
||||
continue
|
||||
for {
|
||||
input := ssm.GetParametersByPathInput{
|
||||
Path: aws.String(paramsPath),
|
||||
WithDecryption: aws.Bool(true),
|
||||
NextToken: nextToken,
|
||||
}
|
||||
|
||||
if p.DataType == nil || *p.DataType != "text" {
|
||||
continue
|
||||
output, err := svc.GetParametersByPath(&input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't retrieve parameters from AWS SSM: %s", err)
|
||||
}
|
||||
|
||||
name := *p.Name
|
||||
for _, p := range output.Parameters {
|
||||
if p == nil || p.Name == nil || p.Value == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
env := strings.ReplaceAll(
|
||||
strings.TrimPrefix(strings.TrimPrefix(name, paramsPath), "/"),
|
||||
"/", "_",
|
||||
)
|
||||
if p.DataType == nil || *p.DataType != "text" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err = os.Setenv(env, *p.Value); err != nil {
|
||||
return fmt.Errorf("Can't set %s env variable from AWS SSM: %s", env, err)
|
||||
name := *p.Name
|
||||
|
||||
env := strings.ReplaceAll(
|
||||
strings.TrimPrefix(strings.TrimPrefix(name, paramsPath), "/"),
|
||||
"/", "_",
|
||||
)
|
||||
|
||||
if err = os.Setenv(env, *p.Value); err != nil {
|
||||
return fmt.Errorf("Can't set %s env variable from AWS SSM: %s", env, err)
|
||||
}
|
||||
}
|
||||
|
||||
if nextToken = output.NextToken; nextToken == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user