| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,4 +12,4 @@ jobs: | |||
| 12 | 12 | - uses: actions/setup-go@v2 | |
| 13 | 13 | with: | |
| 14 | 14 | go-version: '^1.16.0' | |
| 15 | - - run: go test | ||
| 15 | + - run: go test ./... --tags=test | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,4 +2,3 @@ config/ | |||
| 2 | 2 | data/ | |
| 3 | 3 | .idea/ | |
| 4 | 4 | Gokapi | |
| 5 | - test/ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ RUN cd /compile && go mod download | |||
| 10 | 10 | ||
| 11 | 11 | COPY . /compile | |
| 12 | 12 | ||
| 13 | - RUN cd /compile && go generate && CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/internal/environment.IsDocker=true' -X 'Gokapi/internal/environment.Builder=Project Docker File' -X 'Gokapi/internal/environment.BuildTime=$(date)'" -o /compile/gokapi | ||
| 13 | + RUN cd /compile && go generate Gokapi/cmd/gokapi && CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/internal/environment.IsDocker=true' -X 'Gokapi/internal/environment.Builder=Project Docker File' -X 'Gokapi/internal/environment.BuildTime=$(date)'" -o /compile/gokapi Gokapi/cmd/gokapi | ||
| 14 | 14 | ||
| 15 | 15 | FROM alpine:3.13 | |
| 16 | 16 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ Download Link. If you want to compile the source yourself, clone this repository and execute `go build`. | ||
| 32 | + Simply download the latest release for your platform and execute the binary (recommended). If you want to compile the source yourself, clone this repository and execute `go build Gokapi/cmd/gokapi` (requires Go 1.16+). | ||
| 33 | 33 | ||
| 34 | 34 | ### Docker | |
| 35 | 35 | ||
@@ -94,7 +94,7 @@ By default, all files are included in the executable. If you want to change the | |||
| 94 | 94 | * Copy either the folder `static`, `templates` or both from the `web` folder to the directory where the executable is located | |
| 95 | 95 | * Make changes to the folders. `static` contains images, CSS files and JavaScript. `templates` contains the HTML code. | |
| 96 | 96 | * Restart the server. If the folders exist, the server will use the local files instead of the embedded files | |
| 97 | - * Optional: To embed the files permanently, the executable needs to be recompiled with `go build`. | ||
| 97 | + * Optional: To embed the files permanently, copy the modified files back to the original folders and recompiled with `go build Gokapi/cmd/gokapi`. | ||
| 98 | 98 | ||
| 99 | 99 | ||
| 100 | 100 | ## Contributors | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,18 +6,18 @@ set -e | |||
| 6 | 6 | targets=${@-"darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 windows/amd64 windows/386"} | |
| 7 | 7 | ||
| 8 | 8 | cd /usr/src/myapp | |
| 9 | - go generate | ||
| 9 | + go generate Gokapi/cmd/gokapi | ||
| 10 | 10 | ||
| 11 | 11 | for target in $targets; do | |
| 12 | 12 | os="$(echo $target | cut -d '/' -f1)" | |
| 13 | 13 | arch="$(echo $target | cut -d '/' -f2)" | |
| 14 | - output=".release/gokapi-${os}_${arch}" | ||
| 14 | + output="build/gokapi-${os}_${arch}" | ||
| 15 | 15 | if [ $os = "windows" ]; then | |
| 16 | 16 | output+='.exe' | |
| 17 | 17 | fi | |
| 18 | 18 | ||
| 19 | 19 | echo "----> Building project for: $target" | |
| 20 | - GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/internal/environment.Builder=Github Release Builder' -X 'Gokapi/internal/environment.BuildTime=$(date)'" -o $output | ||
| 20 | + GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/internal/environment.Builder=Github Release Builder' -X 'Gokapi/internal/environment.BuildTime=$(date)'" -o $output Gokapi/cmd/gokapi | ||
| 21 | 21 | zip -j $output.zip $output > /dev/null | |
| 22 | 22 | rm $output | |
| 23 | 23 | done | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | 1 | #!/bin/sh | |
| 2 | 2 | #Called by go generate | |
| 3 | 3 | #Sets the version number in the template automatically | |
| 4 | - sed -i 's/{{define "version"}}.*{{end}}/{{define "version"}}'$1'{{end}}/g' ./web/templates/string_constants.tmpl | ||
| 4 | + sed -i 's/{{define "version"}}.*{{end}}/{{define "version"}}'$1'{{end}}/g' ../../internal/webserver/web/templates/string_constants.tmpl | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,6 @@ import ( | |||
| 9 | 9 | "Gokapi/internal/environment" | |
| 10 | 10 | "Gokapi/internal/storage" | |
| 11 | 11 | "Gokapi/internal/webserver" | |
| 12 | - "embed" | ||
| 13 | 12 | "fmt" | |
| 14 | 13 | "math/rand" | |
| 15 | 14 | "os" | |
@@ -20,7 +19,7 @@ import ( | |||
| 20 | 19 | // The go generate call below needs to be modified as well | |
| 21 | 20 | const Version = "1.1.4-dev" | |
| 22 | 21 | ||
| 23 | - //go:generate sh "./build/setVersionTemplate.sh" "1.1.4-dev" | ||
| 22 | + //go:generate sh "../../build/setVersionTemplate.sh" "1.1.4-dev" | ||
| 24 | 23 | ||
| 25 | 24 | // Main routine that is called on startup | |
| 26 | 25 | func main() { | |
@@ -31,7 +30,7 @@ func main() { | |||
| 31 | 30 | configuration.Load() | |
| 32 | 31 | checkArguments() | |
| 33 | 32 | go storage.CleanUp(true) | |
| 34 | - webserver.Start(&StaticFolderEmbedded, &TemplateFolderEmbedded, true) | ||
| 33 | + webserver.Start() | ||
| 35 | 34 | } | |
| 36 | 35 | ||
| 37 | 36 | // Checks for command line arguments that have to be parsed before loading the configuration | |
@@ -59,16 +58,6 @@ func checkArguments() { | |||
| 59 | 58 | } | |
| 60 | 59 | } | |
| 61 | 60 | ||
| 62 | - // StaticFolderEmbedded is the embedded version of the "static" folder | ||
| 63 | - // This contains JS files, CSS, images etc | ||
| 64 | - //go:embed web/static | ||
| 65 | - var StaticFolderEmbedded embed.FS | ||
| 66 | - | ||
| 67 | - // TemplateFolderEmbedded is the embedded version of the "templates" folder | ||
| 68 | - // This contains templates that Gokapi uses for creating the HTML output | ||
| 69 | - //go:embed web/templates | ||
| 70 | - var TemplateFolderEmbedded embed.FS | ||
| 71 | - | ||
| 72 | 61 | // ASCII art logo | |
| 73 | 62 | const logo = ` | |
| 74 | 63 | ██████ ██████ ██ ██ █████ ██████ ██ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ module Gokapi | |||
| 3 | 3 | go 1.16 | |
| 4 | 4 | ||
| 5 | 5 | require ( | |
| 6 | + github.com/otiai10/copy v1.5.1 | ||
| 6 | 7 | golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 | |
| 7 | 8 | golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect | |
| 8 | 9 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,10 @@ | |||
| 1 | - github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
| 2 | - github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
| 3 | - github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
| 4 | - github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
| 5 | - github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
| 6 | - github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= | ||
| 7 | - github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
| 1 | + github.com/otiai10/copy v1.5.1 h1:a/cs2E1/1V0az8K5nblbl+ymEa4E11AfaOLMar8V34w= | ||
| 2 | + github.com/otiai10/copy v1.5.1/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= | ||
| 3 | + github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= | ||
| 4 | + github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= | ||
| 5 | + github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= | ||
| 6 | + github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= | ||
| 7 | + github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= | ||
| 8 | 8 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | |
| 9 | 9 | golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= | |
| 10 | 10 | golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | |
@@ -17,7 +17,3 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR | |||
| 17 | 17 | golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= | |
| 18 | 18 | golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | |
| 19 | 19 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | |
| 20 | - gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
| 21 | - gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
| 22 | - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
| 23 | - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments