51 lines
1.5 KiB
Go
51 lines
1.5 KiB
Go
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
|