Skip to content

Commit

Permalink
Merge branch 'release/v0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
tectiv3 committed May 17, 2019
2 parents e7739a5 + eea575c commit dc6abd2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 61 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pid
log
dist
standardfile.exe
vendor
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ builds:
env:
- CGO_ENABLED=0
hooks:
pre: ./build-linux-cgo.sh
post: ./build-linux-cgo.sh
release:
github:
owner: tectiv3
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ To disable registration run with `standardfile -noreg`
Run with -cors flag to enable automatic cors handling (needed for standardnotes app for example).

### Deploying to a live server
I suggest putting it behind nginx or caddy with https enabled location
I suggest putting it behind nginx or [caddy](https://caddyserver.com/) with https enabled location.
- nginx sample config
```
server {
server_name sf.example.com;
Expand Down Expand Up @@ -114,6 +115,17 @@ server {
}
}
```
- caddy sample config
```
sf.example.com {
gzip
proxy / localhost:8888 {
transparent
}
}
```

### Optional Environment variables

**SECRET_KEY_BASE**
Expand Down
29 changes: 19 additions & 10 deletions build-linux-cgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ BUILD_TIME=`date +%FT%T%z`

xgo -ldflags="-w -X main.BuildTime=$BUILD_TIME -X main.Version=$VERSION" --targets="linux/386,linux/amd64,linux/arm-6,linux/arm-7,linux/arm64" .

mkdir dist/linux_386
mv standardfile-linux-386 dist/linux_386/standardfile
VERSION=${VERSION#v}

mkdir dist/linux_amd64
mv standardfile-linux-amd64 dist/linux_amd64/standardfile
mv standardfile-linux-386 standardfile
tar czf standardfile_${VERSION}_linux_32-bit.tar.gz standardfile
rm -f standardfile

mkdir dist/linux_arm6
mv standardfile-linux-arm-6 dist/linux_arm6/standardfile
mv standardfile-linux-amd64 standardfile
tar czf standardfile_${VERSION}_linux_64-bit.tar.gz standardfile
rm -f standardfile

mkdir dist/linux_arm7
mv standardfile-linux-arm-7 dist/linux_arm7/standardfile
mv standardfile-linux-arm-6 standardfile
tar czf standardfile_${VERSION}_linux_arm6.tar.gz standardfile
rm -f standardfile

mkdir dist/linux_arm8
mv standardfile-linux-arm64 dist/linux_arm8/standardfile
mv standardfile-linux-arm-7 standardfile
tar czf standardfile_${VERSION}_linux_arm7.tar.gz standardfile
rm -f standardfile

mv standardfile-linux-arm64 standardfile
tar czf standardfile_${VERSION}_linux_arm8.tar.gz standardfile
rm -f standardfile

mv standardfile_${VERSION}* dist/
29 changes: 0 additions & 29 deletions glide.lock

This file was deleted.

11 changes: 0 additions & 11 deletions glide.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.12
require (
github.com/deckarep/golang-set v1.7.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/go-playground/ansi v2.1.0+incompatible
github.com/go-playground/form v3.1.4+incompatible
github.com/go-playground/ansi v2.1.0+incompatible // indirect
github.com/go-playground/form v3.1.4+incompatible // indirect
github.com/go-playground/pure v0.0.0-20170911042516-dd99f50b7780
github.com/go-yaml/yaml v2.1.0+incompatible // indirect
github.com/heetch/confita v0.5.1
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/kisielk/sqlstruct v0.0.0-20150923205031-648daed35d49
github.com/mattn/go-sqlite3 v1.10.0
github.com/pkg/errors v0.8.1 // indirect
Expand Down
19 changes: 13 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"os"
"runtime"
"strconv"
"syscall"

"github.com/sevlyar/go-daemon"
Expand All @@ -24,7 +25,7 @@ type Config struct {
NoReg bool `config:"noreg"`
Debug bool `config:"debug"`
Foreground bool `config:"foreground"`
UseCORS bool `config:"cors"`
UseCORS bool `config:"cors" json:"cors" yaml:"cors" toml:"cors"`
}

var cfg = Config{
Expand Down Expand Up @@ -70,11 +71,17 @@ func main() {
flag.Parse()

if *ver {
fmt.Println(` Version: ` + Version + `
Built: ` + BuildTime + `
Go version: ` + runtime.Version() + `
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH)

fmt.Println(` Version: ` + Version + `
Built: ` + BuildTime + `
Go Version: ` + runtime.Version() + `
OS/Arch: ` + runtime.GOOS + "/" + runtime.GOARCH + `
No Registrations: ` + strconv.FormatBool(cfg.NoReg) + `
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
Run in Foreground: ` + strconv.FormatBool(cfg.Foreground) + `
Webserver Port: ` + strconv.Itoa(cfg.Port) + `
CORS Enabled: ` + strconv.FormatBool(cfg.UseCORS) + `
DB Path: ` + cfg.DB + `
Debug: ` + strconv.FormatBool(cfg.Debug))
return
}

Expand Down

0 comments on commit dc6abd2

Please sign in to comment.