mirror of
https://github.com/foomo/squadron.git
synced 2025-10-16 12:35:42 +00:00
feat: allow template string
This commit is contained in:
parent
cc2a0e603c
commit
c9de37cd41
13
squadron.go
13
squadron.go
@ -54,13 +54,16 @@ func New(basePath, namespace string, files []string) *Squadron {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
func (sq *Squadron) Namespace(ctx context.Context, squadron, unit string, u *config.Unit) (string, error) {
|
||||
if u.Namespace != "" {
|
||||
return u.Namespace, nil
|
||||
}
|
||||
if sq.namespace == "" {
|
||||
var tpl string
|
||||
switch {
|
||||
case u.Namespace != "":
|
||||
tpl = u.Namespace
|
||||
case sq.namespace != "":
|
||||
tpl = sq.namespace
|
||||
default:
|
||||
return "default", nil
|
||||
}
|
||||
return util.RenderTemplateString(sq.namespace, map[string]string{"Squadron": squadron, "Unit": unit})
|
||||
return util.RenderTemplateString(tpl, map[string]string{"Squadron": squadron, "Unit": unit})
|
||||
}
|
||||
|
||||
func (sq *Squadron) Config() config.Config {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user