Evan Chen 69ad2a961c | ||
---|---|---|
cmd/configui | ||
docs | ||
public | ||
src | ||
templates | ||
.dockerignore | ||
.drone.yml | ||
.gitignore | ||
CHANGELOG.md | ||
Dockerfile | ||
Makefile | ||
README.md | ||
app.go | ||
configui.go | ||
file.go | ||
go.mod | ||
go.sum | ||
handler.go | ||
package-lock.json | ||
package.json | ||
release.sh | ||
server.go | ||
util.go |
README.md
Config UI
a web app to edit and action on update powered by ACE
Usage: configui [options]
-allow string
IPs to allow, blank to allow all
-bind string
address to bind (default "0.0.0.0:8000")
-c string
cmd to apply
-f string
path to config file
-log string
log to file
-n string
Name of file
-p string
path to file, precedence over config
-static
disable config api
-v show version
Install
sudo rm -f /usr/local/bin/configui
sudo sh -c "curl -fsSL RELEASE_URL | tar -C /usr/local/bin/ -xz"
Config
{
"app_name": "ConfigUI",
"base_url": "/",
"config_path": "conf.json",
"no_reconfig": false,
"allow_ip": "",
"files": [
{
"path": "main.go",
"name": "GoPlayground",
"action": "go run main.go",
"ro": false,
"lang": "",
"order": 0,
"data": ""
}
],
"Actions": [
{
"name": "User",
"cmd": "whoami"
}
],
"result_bellow": false,
"hide_config": false,
"log_path": "access.log",
"silent_sys_out": false
}
configui -f PATH/TO/CONFIG
Add integrations to ConfigUI
cui.Integrations = append(cui.Integrations, &configui.Integration{
Name: "test", Description: "test", Cmd: func() (string, error) {
if rand.Int31n(40) > 20 {
return "ok", nil
}
return "", fmt.Errorf("error")
},
})
Systemd
; /etc/systemd/system/configui.service
[Unit]
Description=CoonfigUI Server
[Service]
WorkingDirectory=/home/ubuntu/ConfigUI
ExecStart=configui -log access.log -f conf.json -bind 0.0.0.0:80
Restart=always
[Install]
WantedBy=multi-user.target
Use as a sub route
cui.BaseUrl = "/configui/"
mux := http.NewServeMux()
mux.Handle("/configui/", http.StripPrefix("/configui", cui))
Use as subpath in caddy
DOMAIN {
...
route /configui/* {
uri strip_prefix /configui
reverse_proxy localhost:8000
}
...
}
Api
Files
GET /api/files
res:
{
"test": {
"path": "test",
"name": "test",
"action": "myip local -P",
"data": ""
}
}
File
GET /api/file?name=Name
res:
{
"action": "myip local -P",
"data": "test",
"name": "test",
"path": "test"
}
Update
POST /api/file
req:
{
"data": "test",
"name": "test",
}
Apply
POST /api/apply?name=Name