Skip to content

Commit

Permalink
types: display hostname in the deposit object
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Nov 29, 2024
1 parent 8917dce commit e7601ee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/types/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"fmt"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -157,6 +158,16 @@ func (d *Deposit) SlackAttachment() slack.Attachment {
})
}

// This is actually a hack to display the deposited account in the slack message
hostname := getHostname()
if hostname != "" && hostname != "localhost" {
fields = append(fields, slack.AttachmentField{
Title: "Hostname",
Value: hostname,
Short: false,
})
}

fields = append(fields, slack.AttachmentField{
Title: "Amount",
Value: d.Amount.String() + " " + d.Asset,
Expand Down Expand Up @@ -242,3 +253,7 @@ func depositStatusSlackColor(status DepositStatus) string {

}
}

func getHostname() string {
return os.Getenv("HOSTNAME")
}

0 comments on commit e7601ee

Please sign in to comment.