mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
feat(lambda): allow per-runtime image reference overrides (#4552)
* feat(lambda): allow per-runtime image reference overrides * test(lambda): cover runtime image YAML configuration * docs(lambda): show quoted runtime image env key * test(lambda): verify quoted runtime image env key --------- Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
This commit is contained in:
1 parent
b112c62949
commit
f074dd3c40
9 files changed
+139
No files matched your search
@@ -4,6 +4,7 @@ import io.smallrye.config.ConfigMapping;
|
||||
import io.smallrye.config.WithDefault;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
@@ -2699,6 +2700,9 @@ public interface EmulatorConfig {
|
||||
@WithDefault("public.ecr.aws") // partition-literal: configurable; ECR Public exists only in the commercial partition
|
||||
String ecrBaseUri();
|
||||
|
||||
/** Full image references for individual runtimes, keyed by Lambda runtime identifier. */
|
||||
Map<String, String> runtimeImages();
|
||||
|
||||
@WithDefault("128")
|
||||
int defaultMemoryMb();
|
||||
|
||||
|
||||
@@ -45,9 +45,11 @@ public class ImageResolver {
|
||||
);
|
||||
|
||||
private final String baseUri;
|
||||
private final Map<String, String> runtimeImages;
|
||||
|
||||
public ImageResolver(EmulatorConfig config) {
|
||||
this.baseUri = config.services().lambda().ecrBaseUri();
|
||||
this.runtimeImages = config.services().lambda().runtimeImages();
|
||||
}
|
||||
|
||||
public String resolve(String runtime) {
|
||||
@@ -63,6 +65,9 @@ public class ImageResolver {
|
||||
throw new AwsException("InvalidParameterValueException",
|
||||
"The runtime parameter " + runtime + " is not supported.", 400);
|
||||
}
|
||||
if (runtimeImages != null && runtimeImages.containsKey(runtime)) {
|
||||
return runtimeImages.get(runtime);
|
||||
}
|
||||
return baseUri + "/lambda/" + image;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user