Go to file
Evan Chen 639e3e97a5 feat: shrink modal width 2021-11-30 18:42:33 +08:00
cmd/configui add configui 2021-11-30 16:34:36 +08:00
docs wip/refact-lib (#36) 2021-10-23 04:56:24 +00:00
public feat: shrink modal width 2021-11-30 18:42:33 +08:00
src feat: shrink modal width 2021-11-30 18:42:33 +08:00
templates feat: shrink modal width 2021-11-30 18:42:33 +08:00
.dockerignore build: add npm 2021-10-19 14:32:10 +08:00
.drone.yml fix: lib mode in subpath 2021-10-24 15:06:02 +08:00
.gitignore wip/refact-lib (#36) 2021-10-23 04:56:24 +00:00
CHANGELOG.md feat: #37 fix: #38 2021-10-24 14:32:55 +08:00
Dockerfile wip/refact-lib (#36) 2021-10-23 04:56:24 +00:00
Makefile 0.1.2-rc1 2021-10-24 01:23:57 +08:00
README.md fix: #56 2021-11-17 17:24:04 +08:00
app.go fix: deprecate 'action' and use 'cmd' in file 2021-11-11 10:21:10 +08:00
configui.go update version 2021-11-30 16:40:58 +08:00
errors.go chore 2021-11-15 16:54:55 +08:00
file.go fix: #56 2021-11-17 17:24:04 +08:00
go.mod add configui 2021-11-30 16:34:36 +08:00
go.sum add configui 2021-11-30 16:34:36 +08:00
handler.go fix: file blocked by reporter 2021-11-18 01:51:18 +08:00
package-lock.json chore 2021-11-15 16:54:55 +08:00
package.json chore 2021-11-15 16:54:55 +08:00
release.sh build: add build flag 2021-11-08 17:03:22 +08:00
schema.json add configui 2021-11-30 16:34:36 +08:00
server.go add configui 2021-11-30 16:34:36 +08:00
util.go chore 2021-11-15 16:54:55 +08:00

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

config

{
  "cust":"path/to/dir"
}

No link

path/to/dir/none.tmpl

{{ define "links" }}
<!-- none -->
{{end}}

Custom links

path/to/dir/links.tmpl

{{ define "links" }}
<a class="button is-white level-item" 
  href="https://kumoly.io/tools/configui/issues"
>Report Issue</a>
{{end}}

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