Skip to content

Commit

Permalink
fix: currency blank
Browse files Browse the repository at this point in the history
  • Loading branch information
tyzbit committed May 1, 2022
1 parent 4ae647a commit fc21b14
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions btc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ func (w Watcher) ConvertBalance(balanceSat int) (float64, error) {
currency := strings.ToUpper(w.Currency)
bitcoinBalance := float64(balanceSat) / float64(SatsPerBitcoin)
switch currency {
case "USD":
balanceFiat = price.USD * bitcoinBalance
case "EUR":
balanceFiat = price.EUR * bitcoinBalance
case "GBP":
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ func main() {
r.Static("/static", "web/static")
r.GET("/", watcher.Home)

thing := ":" + fmt.Sprintf(watcher.Port)
err = r.Run(thing)
err = r.Run(":" + fmt.Sprintf(watcher.Port))
if err != nil {
log.Fatal("could not start: ", err)
}
Expand Down
3 changes: 3 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func (w Watcher) FillDefaults() {
if w.Port == "" {
watcher.Port = "80"
}
if w.Currency == "" {
watcher.Currency = "USD"
}

// Set up DB path
// Create the folder path if it doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion web/templates/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
<title>Bitcoin Balance Notifier</title>
<link rel="stylesheet" type="text/css" href="static/desktop.css" media="screen" />
<!-- <link rel="stylesheet" type="text/css" href="mobile.css" media="handheld" /> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
Expand Down

0 comments on commit fc21b14

Please sign in to comment.