file-service
is a nodejs service based from express and route file-service provides for abcdesktop :
upload
filedownload
filedownload directory
( with zip features )delete
filedelete
directory
file-service is used by oc.filer and oc.cupsd images.
echo "Yet another test file" > ~/dummy.txt
DISABLE_REMOTEIP_FILTERING=true yarn start 2>file-service.error > file-service.log &
curl http://localhost:29783/filer?file=~/dummy.txt
you get
Yet another test file
curl http://localhost:29783/filer?file=/etc/passwd
you get
{"code":400,"data":"Path Server Error"}
The API documentation is avalable in file https://github.com/abcdesktopio/file-service/file-service.md
method | feature |
---|---|
GET | GET file |
POST | POST file |
DELETE | DELETE file |
Each main features can de disable by env vars.
var name | feature |
---|---|
SENDFILE | Allow http get |
ACCEPTFILE | Allow http put |
ACCEPTLISTFILE | Allow http list file (use json format) |
ACCEPTDELETEFILE | Allow http delete |
To disable a feature, set env var to false
export ACCEPTDELETEFILE=false
yarn start
To enable a feature, set env var to true
.
Be default all features are enabled.
export ACCEPTDELETEFILE=true
yarn start
The defautl tcp port for this http service is 29783
process.env.FILE_SERVICE_TCP_PORT || 29783
By default each http request must come from the nginx reverse proxy source ip addr. To disable ip source filter set the DISABLE_REMOTEIP_FILTERING
to true
export DISABLE_REMOTEIP_FILTERING=true
All requested files must be located inside the user home directory. The root direcotry is equal to the user's home directory.
rootdir = process.env.HOME
yarn install
This command installs file service modules.
DISABLE_REMOTEIP_FILTERING=true yarn start
This command start a file service and listen to the default tcp port.
CONTAINER_IP=127.0.0.1 yarn test
This command run test file one a running file service.
yarn docs
This command create a file-service.md
file.