File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ FROM gcr.io/distroless/static as test
25
25
USER 0:0
26
26
WORKDIR /app
27
27
COPY --from=build /go/src/github.com/webdevops/azure-resourcegraph-exporter/azure-resourcegraph-exporter .
28
- COPY --from=build /go/src/github.com/webdevops/azure-resourcegraph-exporter/templates ./templates
29
28
RUN ["./azure-resourcegraph-exporter" , "--help" ]
30
29
31
30
# ############################################
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "embed"
4
5
"encoding/base64"
5
6
"errors"
6
7
"fmt"
39
40
40
41
metricCache * cache.Cache
41
42
43
+ //go:embed templates/*.html
44
+ templates embed.FS
45
+
42
46
// Git version information
43
47
gitCommit = "<unknown>"
44
48
gitTag = "<unknown>"
@@ -152,7 +156,7 @@ func startHttpServer() {
152
156
})
153
157
154
158
// report
155
- reportTmpl := template .Must (template .ParseFiles ( "./ templates/query .html" ))
159
+ tmpl := template .Must (template .ParseFS ( templates , " templates/* .html" ))
156
160
mux .HandleFunc ("/query" , func (w http.ResponseWriter , r * http.Request ) {
157
161
cspNonce := base64 .StdEncoding .EncodeToString ([]byte (uuid .New ().String ()))
158
162
@@ -174,7 +178,7 @@ func startHttpServer() {
174
178
Nonce : cspNonce ,
175
179
}
176
180
177
- if err := reportTmpl . Execute ( w , templatePayload ); err != nil {
181
+ if err := tmpl . ExecuteTemplate ( w , "query.html" , templatePayload ); err != nil {
178
182
log .Error (err )
179
183
}
180
184
})
You can’t perform that action at this time.
0 commit comments