chore: update dockerfile, readme, etc

This commit is contained in:
2024-08-18 06:33:58 +07:00
parent b554cb4dbf
commit 6ad70370d1
11 changed files with 82 additions and 29 deletions
+51
View File
@@ -0,0 +1,51 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = false
[misc]
clean_on_exit = false
[proxy]
app_port = 0
enabled = false
proxy_port = 0
[screen]
clear_on_rebuild = false
keep_scroll = true
+1 -1
View File
@@ -1,6 +1,6 @@
build:
go build -o main -tags="prod" main.go
CGO_ENABLED=0 go build -o main -tags="prod" main.go
run:
go run main.go
+4 -1
View File
@@ -2,4 +2,7 @@ module khairul169/garage-webui
go 1.22.5
require github.com/pelletier/go-toml/v2 v2.2.2 // indirect
require (
github.com/joho/godotenv v1.5.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
)
+2
View File
@@ -1,5 +1,7 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+5 -1
View File
@@ -7,9 +7,13 @@ import (
"khairul169/garage-webui/utils"
"log"
"net/http"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
if err := utils.Garage.LoadConfig(); err != nil {
log.Fatal("Failed to load config! ", err)
}
@@ -21,7 +25,7 @@ func main() {
ui.ServeUI()
host := utils.GetEnv("HOST", "0.0.0.0")
port := utils.GetEnv("PORT", "3908")
port := utils.GetEnv("PORT", "3909")
addr := fmt.Sprintf("%s:%s", host, port)
log.Printf("Starting server on http://%s", addr)
+1 -1
View File
@@ -21,7 +21,7 @@ type garage struct {
var Garage = &garage{}
func (g *garage) LoadConfig() error {
path := GetEnv("CONFIG_PATH", "/etc/garage/garage.toml")
path := GetEnv("CONFIG_PATH", "/etc/garage.toml")
data, err := os.ReadFile(path)
if err != nil {