-
Notifications
You must be signed in to change notification settings - Fork 0
Validate license before starting container #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,10 +14,12 @@ const ( | |
| EmulatorAWS EmulatorType = "aws" | ||
| EmulatorSnowflake EmulatorType = "snowflake" | ||
| EmulatorAzure EmulatorType = "azure" | ||
|
|
||
| dockerRegistry = "localstack" | ||
| ) | ||
|
|
||
| var emulatorImages = map[EmulatorType]string{ | ||
| EmulatorAWS: "localstack/localstack-pro", | ||
| EmulatorAWS: "localstack-pro", | ||
| } | ||
|
|
||
| var emulatorHealthPaths = map[EmulatorType]string{ | ||
|
|
@@ -36,15 +38,15 @@ type ContainerConfig struct { | |
| } | ||
|
|
||
| func (c *ContainerConfig) Image() (string, error) { | ||
| baseImage, ok := emulatorImages[c.Type] | ||
| if !ok { | ||
| return "", fmt.Errorf("%s emulator not supported yet by lstk", c.Type) | ||
| productName, err := c.ProductName() | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| tag := c.Tag | ||
| if tag == "" { | ||
| tag = "latest" | ||
| } | ||
| return fmt.Sprintf("%s:%s", baseImage, tag), nil | ||
| return fmt.Sprintf("%s/%s:%s", dockerRegistry, productName, tag), nil | ||
| } | ||
|
|
||
| // Name returns the container name: "localstack-{type}" or "localstack-{type}-{tag}" if tag != latest | ||
|
|
@@ -64,6 +66,14 @@ func (c *ContainerConfig) HealthPath() (string, error) { | |
| return path, nil | ||
| } | ||
|
|
||
| func (c *ContainerConfig) ProductName() (string, error) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: did we check that the other products are actually binding their product name to the image name? I think for snowflake it might not be just
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we do this tiny refactoring later when we need to? |
||
| productName, ok := emulatorImages[c.Type] | ||
| if !ok { | ||
| return "", fmt.Errorf("%s emulator not supported yet by lstk", c.Type) | ||
| } | ||
| return productName, nil | ||
| } | ||
|
|
||
| func ConfigDir() (string, error) { | ||
| configHome, err := os.UserConfigDir() | ||
| if err != nil { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.