feat: updated server implementation

This commit is contained in:
David Allen 2025-08-18 11:09:51 -06:00
parent 0d27f07a8b
commit d56a9e452f
Signed by: towk
GPG key ID: 0430CDBE22619155
5 changed files with 348 additions and 75 deletions

51
pkg/service/constants.go Normal file
View file

@ -0,0 +1,51 @@
package service
const (
RELPATH_PLUGINS = "/plugins"
RELPATH_PROFILES = "/profiles"
RELPATH_DATA = "/data"
RELPATH_METADATA = "/.configurator"
RELPATH_HELP = RELPATH_DATA + "/index.html"
DEFAULT_TIMEOUT_IN_SECS = 60
DEFAULT_PLUGINS_MAX_COUNT = 64
DEFAULT_PROFILES_MAX_COUNT = 256
DEFAULT_METADATA = ``
DEFAULT_HOME = `
<!DOCTYPE html>
<html>
<body>
<p>
# setup environment variables</br>
export CONFIGURATOR_HOST={{ configurator.host }}</br>
export CONFIGURATOR_PATH={{ configurator.path }}</br>
export CONFIGURATOR_SERVER_ROOT={{ configurator.server_root }}</br>
</br>
# start the service</br>
configurator serve --root $HOME/apps/configurator/server --init</br>
</br>
# download a file or directory (as archive)</br>
configurator download</br>
configurator download --host http://localhost:5050 --path help.txt</br>
</br>
# download files with rendering using plugins</br>
configurator download --plugins smd,jinja2 --profile compute</br>
curl $CONFIGURATOR_HOST/download/help.txt?plugins=smd,jinja2</br>
</br>
# upload a file or directory (recursively)</br>
configurator upload</br>
configurator upload --host http://localhost:5050 --path help.txt</br>
</br>
# list the files in a directory</br>
configurator list --path help.txt</br>
configurator list --host http://localhost:5050 --path help.txt</br>
curl http://localhost:5050/list/test</br>
</p>
<body>
</html>
`
)
// configurator.host: https://example.com
// configurator.path: test
// configurator.server_root: $HOME/apps/configurator