70 lines
1.8 KiB
Go
70 lines
1.8 KiB
Go
package service
|
|
|
|
const (
|
|
RELPATH_PLUGINS = "/plugins"
|
|
RELPATH_PROFILES = "/profiles"
|
|
RELPATH_DATA = "/data"
|
|
RELPATH_METADATA = "/.makeshift"
|
|
RELPATH_HELP = RELPATH_DATA + "/index.html"
|
|
RELPATH_PROFILE = RELPATH_PROFILES + "/default.json"
|
|
|
|
PATH_CONFIG = "$HOME/.config/makeshift/config.yaml"
|
|
|
|
DEFAULT_TIMEOUT_IN_SECS = 60
|
|
DEFAULT_PLUGINS_MAX_COUNT = 32
|
|
DEFAULT_PROFILES_MAX_COUNT = 256
|
|
|
|
FILE_METADATA = ``
|
|
FILE_HOME_PAGE = `
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<p>
|
|
# setup environment variables</br>
|
|
export MAKESHIFT_HOST={{ makeshift.host }}</br>
|
|
export MAKESHIFT_PATH={{ makeshift.path }}</br>
|
|
export MAKESHIFT_SERVER_ROOT={{ makeshift.server.root }}</br>
|
|
</br>
|
|
# start the service</br>
|
|
makeshift serve --root $HOME/apps/makeshift/server --init</br>
|
|
</br>
|
|
# download a file or directory (as archive)</br>
|
|
makeshift download</br>
|
|
makeshift download --host http://localhost:5050 --path help.txt</br>
|
|
</br>
|
|
# download files with rendering using plugins</br>
|
|
makeshift download --plugins smd,jinja2 --profile compute</br>
|
|
curl $MAKESHIFT_HOST/download/help.txt?plugins=smd,jinja2</br>
|
|
</br>
|
|
# upload a file or directory (recursively)</br>
|
|
makeshift upload</br>
|
|
makeshift upload --host http://localhost:5050 --path help.txt</br>
|
|
</br>
|
|
# list the files in a directory</br>
|
|
makeshift list --path help.txt</br>
|
|
makeshift list --host http://localhost:5050 --path help.txt</br>
|
|
curl http://localhost:5050/list/test</br>
|
|
</p>
|
|
<body>
|
|
</html>
|
|
`
|
|
FILE_DEFAULT_PROFILE = `
|
|
{
|
|
"id": "default",
|
|
"description": "Makeshift default profile",
|
|
"data": {
|
|
"makeshift": {
|
|
"host": "localhost",
|
|
"path": "/test",
|
|
"server": {
|
|
"root": "/test"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
)
|
|
|
|
// makeshift.host: https://localhost:5050
|
|
// makeshift.path: test
|
|
// makeshift.server.root: $HOME/apps/makeshift
|