$darkmode
Elektra 0.11.0
Plugin: curlget

The curlget plugin is a resolver using libcurl to upload and download files from/to remote hosts. When mounted with a URL as configuration file there will be no changes to the file system. When mounted with a (local) path to a configuration a copy of the remote configuration is kept and used as fallback in kdbGet() if fetching the remote file from the server fails.

Installation

See installation. The package is called libelektra5-curl.

Configuration

definitions

URL:

an URL has to be prefixed with the protocol. valid protocols: http://, https://, ftp://, ftps://, scp://, sftp://, smb:// (currently not supported)

Filename:

can bei either an URL or a local configuration file.

if the filename is an URL the plugin operates on temporary files only and keeps no local copy of the configuration. unless specified otherwise the URL is used for both upload and download.

plugin configuration

Example

1 rm /tmp/curltest.ini || $(exit 0)
2 sudo kdb mount -R curlget -c url/get="http://127.0.0.1:8000/curltest.ini",url/put="http://127.0.0.1:8000",user="thomas",password="pass",upload/method="POST",upload/postfield="file" /tmp/curltest.ini system:/curl ini
3 kdb ls system:/curl
4 #> system:/curl/section1
5 #> system:/curl/section1/key1
6 stat /tmp/curltest.ini
7 # RET:0
8 kdb set system:/curl/section1/key2 val2
9 sudo kdb umount system:/curl
10 stat /tmp/curltest.ini
11 # RET:0
12 cat /tmp/curltest.ini
13 #> [section1]
14 #> key1=val1
15 #> key2=val2
16 rm /tmp/curltest.ini || $(exit 0)
17 sudo kdb mount -R curlget -c url/put="http://127.0.0.1:8000",user="thomas",password="pass",upload/method="POST",upload/postfield="file" "http://127.0.0.1:8000/curltest.ini" system:/curl ini
18 kdb ls system:/curl
19 #> system:/curl/section1
20 #> system:/curl/section1/key1
21 #> system:/curl/section1/key2
22 stat /tmp/curltest.ini
23 # RET:1
24 mv /tmp/httproot/curltest.ini /tmp/httproot/curltest.ini_moved
25 kdb ls system:/curl
26 # RET:5
27 mv /tmp/httproot/curltest.ini_moved /tmp/httproot/curltest.ini
28 kdb rm system:/curl/section1/key2
29 sudo kdb umount system:/curl
30 cat /tmp/httproot/curltest.ini
31 #> [section1]
32 #> key1=val1

Mount with HTTP GET + POST and keep local copy

1 kdb mount -R curlget -c url/get="http://127.0.0.1:8000/curltest.ini",url/put="http://127.0.0.1:8000",user="thomas",password="pass",upload/method="POST",upload/postfield="file" /tmp/curltest.ini system:/curl ini

Mount with HTTP GET + POST and keep no local copys

1 kdb mount -R curlget -c url/put="http://127.0.0.1:8000",user="thomas",password="pass",upload/method="POST",upload/postfield="file" "http://127.0.0.1:8000/curltest.ini" system:/curl ini

Mount with FTP GET + PUT and keep local copy

1 kdb mount -R curlget -c url/get="ftp://127.0.0.1:21/test.ini",url/put="ftp://127.0.0.1:21/test.ini",user="thomas",password="pass",upload/method="FTP" /tmp/curltest.ini system:/curl ini