Skip to content

Commit

Permalink
Remove the word Location from tweet message
Browse files Browse the repository at this point in the history
  • Loading branch information
HelixSpiral committed Jul 25, 2023
1 parent e2eb966 commit e21c736
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:alpine as Build

# We need tzdata for the timezone information and the
# ca-certificates for ssl cert verification
RUN apk --no-cache add tzdata ca-certificates

WORKDIR /app

COPY * ./

RUN go build -a -tags netgo -ldflags '-w' -v -o main .

FROM scratch

WORKDIR /app

COPY --from=Build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=Build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=Build /app/main .

CMD [ "/app/main" ]
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
func main() {
// Some initial setup
buoyIDString := os.Getenv("BUOY_ID")
buoyLocation := os.Getenv("BUOY_LOCATION") // There's no clean and easy way to get this from the API, since these buoys don't move we'll just throw it in this way.

buoyID, err := strconv.Atoi(buoyIDString)
if err != nil {
log.Fatalf("Error converting BUOY_ID to int")
Expand All @@ -39,6 +41,10 @@ func main() {

// Send tweet
var tweetMessage string
if buoyLocation != "" {
tweetMessage += fmt.Sprintf("%s: ", buoyLocation)
}

if slices.Contains([]string{
"North", "Northeast",
"East", "Southeast",
Expand Down

0 comments on commit e21c736

Please sign in to comment.