configui/README.md

114 lines
1.5 KiB
Markdown

# Config UI
a web app to edit and action on update powered by [ACE](https://ace.c9.io/#nav=howto&api=edit_session)
```
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
```sh
sudo rm -f /usr/local/bin/configui
sudo sh -c "curl -fsSL RELEASE_URL | tar -C /usr/local/bin/ -xz"
```
## Config
```json
[
{
"path": "configui.log",
"ro": true
},
{
"path": "etc/test.ini",
"name": "test",
"action": "myip local -P"
}
]
```
`configui -f PATH/TO/CONFIG`
## Systemd
```ini
; /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
```
## Api
### Files
`GET /api/files`
res:
```json
{
"test": {
"path": "test",
"name": "test",
"action": "myip local -P",
"data": ""
}
}
```
### File
`GET /api/file?name=Name`
res:
```json
{
"action": "myip local -P",
"data": "test",
"name": "test",
"path": "test"
}
```
### Update
`POST /api/file`
req:
```json
{
"data": "test",
"name": "test",
}
```
### Apply
`POST /api/apply?name=Name`