77 lines
2.2 KiB
Go
77 lines
2.2 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>
|
|
Plugin Information:
|
|
Name: {{ makeshift.plugin.name }}
|
|
Version: {{ makeshift.plugin.version }}
|
|
Description: {{ makeshift.plugin.description }}
|
|
Author: {{ makeshift.plugin.metadata.name }} ({{ makeshift.plugin.metadata.email }})
|
|
|
|
Profile Information:
|
|
ID: {{ makeshift.profiles.default.id }}
|
|
Description: {{ makeshift.profiles.default.description }}
|
|
|
|
# setup environment variables</br>
|
|
export MAKESHIFT_HOST={{ makeshift.profiles.default.data.host }}</br>
|
|
export MAKESHIFT_PATH={{ makeshift.profiles.default.data.path }}</br>
|
|
export MAKESHIFT_SERVER_ROOT={{ makeshift.profiles.default.data.server_root }}</br></br>
|
|
|
|
# start the service</br>
|
|
makeshift serve --root ./tests --init -l debug</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>
|
|
makeshift download -p templates --plugins jinja --profile io</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": {
|
|
"host": "localhost",
|
|
"path": "/test",
|
|
"server_root": "./test"
|
|
}
|
|
}
|
|
`
|
|
)
|
|
|
|
// makeshift.host: https://localhost:5050
|
|
// makeshift.path: test
|
|
// makeshift.server.root: $HOME/apps/makeshift
|