-
Notifications
You must be signed in to change notification settings - Fork 124
feat(compose/agent): add stack.agent.ports option in config.yml to publish ports for agent #1793
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
Changes from 3 commits
d92388d
bc55f5d
a23d0c8
7f32f90
7709032
af9bdba
5b8a49a
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 |
---|---|---|
|
@@ -141,13 +141,13 @@ type Profile struct { | |
} | ||
|
||
// Path returns an absolute path to the given file | ||
func (profile Profile) Path(names ...string) string { | ||
func (profile *Profile) Path(names ...string) string { | ||
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. Nit. Are these changed to pointer needed? 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. so here it depends, it is considered an unusual pattern to have a struct definition that mixes both value and pointer receivers, and from a quick look at the code, profile is widely used as a pointer. Thus I homogenise the struct by making these pointer receivers but if there is a reason behind this divergence happy revert this change 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. Good point. I think I would rather use the profile by value, but it is true that it is mostly used as pointer now, so as you prefer. |
||
elems := append([]string{profile.ProfilePath}, names...) | ||
return filepath.Join(elems...) | ||
} | ||
|
||
// Config returns a configuration setting, or its default if setting not found | ||
func (profile Profile) Config(name string, def string) string { | ||
func (profile *Profile) Config(name string, def string) string { | ||
v, found := profile.overrides[name] | ||
if found { | ||
return v | ||
|
@@ -161,6 +161,10 @@ func (profile Profile) Config(name string, def string) string { | |
return def | ||
} | ||
|
||
func (profile *Profile) Decode(name string, dst any) error { | ||
return profile.config.Decode(name, dst) | ||
} | ||
|
||
// RuntimeOverrides defines configuration overrides for the current session. | ||
func (profile *Profile) RuntimeOverrides(overrides map[string]string) { | ||
profile.overrides = overrides | ||
|
@@ -171,7 +175,7 @@ var ErrNotAProfile = errors.New("not a profile") | |
|
||
// ComposeEnvVars returns a list of environment variables that can be passed | ||
// to docker-compose for the sake of filling out paths and names in the snapshot.yml file. | ||
func (profile Profile) ComposeEnvVars() []string { | ||
func (profile *Profile) ComposeEnvVars() []string { | ||
return []string{ | ||
fmt.Sprintf("PROFILE_NAME=%s", profile.ProfileName), | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.