fixes in rclone module

This commit is contained in:
2024-12-29 14:05:09 +02:00
parent 84d3aaade7
commit f25be20e21
5 changed files with 151 additions and 165 deletions

View File

@@ -2,8 +2,9 @@ module rclone
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.core.texttools
import os
const configfile = '${HOME}/.config/rclone/rclone.conf'
const configfile = '${os.home_dir()}/.config/rclone/rclone.conf'
// will look for personal configuration file in ~/hero/config .
// this file is in heroscript format and will have all required info to configure rclone
@@ -17,13 +18,15 @@ const configfile = '${HOME}/.config/rclone/rclone.conf'
// url:''
//```
pub fn configure() ! {
actions := playbook.new(
path: configfile
actor_filter: ['config']
action_filter: [
's3server_define',
]
mut plbook := playbook.new(
path: rclone.configfile
// actor_filter: ['config']
// action_filter: [
// 's3server_define',
// ]
)!
actions := plbook.find(filter: 'config.s3server_define')!
mut out := ''
for action in actions {
mut name := action.params.get_default('name', '')!

View File

@@ -1,7 +1,6 @@
module rclone
import os
import freeflowuniverse.herolib.core.texttools
// // RCloneClient represents a configured rclone instance
// pub struct RCloneClient {

View File

@@ -2,7 +2,6 @@ module rclone
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console
__global (
rclone_global map[string]&RCloneClient
@@ -91,9 +90,9 @@ pub fn play(args_ PlayArgs) ! {
if install_actions.len > 0 {
for install_action in install_actions {
mut p := install_action.params
mycfg := cfg_play(p)!
console.print_debug('install action rclone.configure\n${mycfg}')
set(mycfg)!
cfg_play(p)!
// console.print_debug('install action rclone.configure\n${mycfg}')
// set(mycfg)!
}
}
}

View File

@@ -34,7 +34,7 @@ pub fn heroscript_default() !string {
pub struct RCloneClient {
pub mut:
name string = 'default'
type_ string = 's3' // remote type (s3, sftp, etc)
type_ string = 's3' // remote type (s3, sftp, etc)
provider string = 'aws' // provider for s3 (aws, minio, etc)
access_key string // access key for authentication
secret_key string // secret key for authentication
@@ -44,13 +44,13 @@ pub mut:
fn cfg_play(p paramsparser.Params) ! {
mut mycfg := RCloneClient{
name: p.get_default('name', 'default')!
type_: p.get_default('type', 's3')!
provider: p.get_default('provider', 'aws')!
name: p.get_default('name', 'default')!
type_: p.get_default('type', 's3')!
provider: p.get_default('provider', 'aws')!
access_key: p.get('access_key')!
secret_key: p.get('secret_key')!
region: p.get_default('region', 'us-east-1')!
endpoint: p.get_default('endpoint', '')!
region: p.get_default('region', 'us-east-1')!
endpoint: p.get_default('endpoint', '')!
}
set(mycfg)!
}