Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
levidurfee committed May 22, 2019
2 parents 959d796 + c4bbd9e commit 02bd31f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.txt
main
main
/dist/*
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ RestartSec=5s
Environment=aws_access_key_id=abcdef223
Environment=aws_secret_access_key=abcdef
Environment=aws_bucket=example-bucket
Environment=aws_endpoint=https://nyc3.digitaloceanspaces.com
Environment=aws_region=us-east-2
Environment=goos_port=8080
ExecStart=/home/user/goos
[Install]
Expand Down
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

version=v1.0.0

env GOOS=windows GOARCH=amd64 go build -o dist/goos.exe cmd/main.go
cd dist
tar -zcvf windows-$version.tar.gz goos.exe
rm goos.exe
cd ..

env GOOS=linux GOARCH=amd64 go build -o dist/goos cmd/main.go
cd dist
tar -zcvf linux-$version.tar.gz goos
rm goos
cd ..
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func main() {
g := &goos.Goos{
KeyID: os.Getenv("aws_access_key_id"),
Secret: os.Getenv("aws_secret_access_key"),
Endpoint: "https://nyc3.digitaloceanspaces.com",
Region: "us-east-2",
Endpoint: os.Getenv("aws_endpoint"),
Region: os.Getenv("aws_region"),
Bucket: os.Getenv("aws_bucket"),
Logger: log,
}
Expand All @@ -35,5 +35,5 @@ func main() {

handler := g.Handler()
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
http.ListenAndServe(":"+os.Getenv("goos_port"), nil)
}
1 change: 1 addition & 0 deletions goos.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func (g *Goos) Handler() http.HandlerFunc {
defer result.Body.Close()

w.Header().Set("Content-Length", strconv.FormatInt(*result.ContentLength, 10))
w.Header().Set("Content-Type", *result.ContentType)
w.Header().Set("Last-Modified", result.LastModified.Format("Mon, 02 Jan 2006 15:04:05 MST"))
w.Header().Set("Expires", time.Now().AddDate(60, 0, 0).Format(http.TimeFormat))
w.Header().Set("Cache-Control", "max-age:290304000")
Expand Down

0 comments on commit 02bd31f

Please sign in to comment.