Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
43a6bcff
Commit
43a6bcff
authored
Mar 03, 2017
by
Fabian Ruff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add .Template.BasePath to template system
parent
0861b5e3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
engine.go
pkg/engine/engine.go
+4
-1
No files found.
pkg/engine/engine.go
View file @
43a6bcff
...
...
@@ -120,6 +120,8 @@ type renderable struct {
tpl
string
// vals are the values to be supplied to the template.
vals
chartutil
.
Values
// namespace prefix to the templates of the current chart
basePath
string
}
// alterFuncMap takes the Engine's FuncMap and adds context-specific functions.
...
...
@@ -178,7 +180,7 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) {
for
_
,
file
:=
range
files
{
// At render time, add information about the template that is being rendered.
vals
:=
tpls
[
file
]
.
vals
vals
[
"Template"
]
=
map
[
string
]
interface
{}{
"Name"
:
file
}
vals
[
"Template"
]
=
map
[
string
]
interface
{}{
"Name"
:
file
,
"BasePath"
:
tpls
[
file
]
.
basePath
}
if
err
:=
t
.
ExecuteTemplate
(
&
buf
,
file
,
vals
);
err
!=
nil
{
return
map
[
string
]
string
{},
fmt
.
Errorf
(
"render error in %q: %s"
,
file
,
err
)
}
...
...
@@ -248,6 +250,7 @@ func recAllTpls(c *chart.Chart, templates map[string]renderable, parentVals char
templates
[
path
.
Join
(
newParentID
,
t
.
Name
)]
=
renderable
{
tpl
:
string
(
t
.
Data
),
vals
:
cvals
,
basePath
:
path
.
Join
(
newParentID
,
"templates"
),
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment