Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
gqgmc
Commits
034506ec
Commit
034506ec
authored
Feb 01, 2017
by
Kevin Lyda
💬
Browse files
Check Volts each page load.
parent
d3ea36bc
Pipeline
#1224
passed with stage
in 1 minute and 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cmd/gqgmcd/main.go
View file @
034506ec
...
@@ -36,6 +36,7 @@ var indexPg indexPage
...
@@ -36,6 +36,7 @@ var indexPg indexPage
func
indexHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
indexHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
indexPg
.
CPM
,
_
=
gc
.
GetCPM
()
indexPg
.
CPM
,
_
=
gc
.
GetCPM
()
indexPg
.
Volts
,
_
=
gc
.
Volts
()
t
,
err
:=
template
.
ParseFiles
(
path
.
Join
(
*
templateDir
,
"index.html"
))
t
,
err
:=
template
.
ParseFiles
(
path
.
Join
(
*
templateDir
,
"index.html"
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"Template error: %s
\n
"
,
err
)
log
.
Printf
(
"Template error: %s
\n
"
,
err
)
...
@@ -50,7 +51,6 @@ func main() {
...
@@ -50,7 +51,6 @@ func main() {
indexPg
.
Model
=
gc
.
Model
()
indexPg
.
Model
=
gc
.
Model
()
indexPg
.
Version
=
gc
.
Version
()
indexPg
.
Version
=
gc
.
Version
()
indexPg
.
Serial
=
gc
.
Serial
()
indexPg
.
Serial
=
gc
.
Serial
()
indexPg
.
Volts
,
_
=
gc
.
Volts
()
http
.
HandleFunc
(
"/"
,
indexHandler
)
http
.
HandleFunc
(
"/"
,
indexHandler
)
http
.
Handle
(
"/metrics"
,
promhttp
.
Handler
())
http
.
Handle
(
"/metrics"
,
promhttp
.
Handler
())
log
.
Fatal
(
http
.
ListenAndServe
(
*
addr
,
nil
))
log
.
Fatal
(
http
.
ListenAndServe
(
*
addr
,
nil
))
...
...
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