I am using the rc mount code in my own GoLang implementation. Is there a way to execute this in non-interactive mode? At the moment when I execute a mount on an encrypted file I get:
2022/10/25 09:52:39 ERROR : Couldn't decrypt configuration, most likely wrong password.
Enter configuration password:
password:
I would like it to exit as an error. I see lots of flags for silencing, but none that seem to be accessible through the rc?
_, err := mountRclone(context.Background(), rc.Params{"fs": "encrypted_storage:", "mountPoint": "./test338", "mountType": "mount", "mountOpt": "{\"AllowNonEmpty\": true}"})
func mountRclone(ctx context.Context, in rc.Params) (out rc.Params, err error) {
mountPoint, err := in.GetString("mountPoint")
if err != nil {
fmt.Println(err)
return nil, err
}
vfsOpt := vfsflags.Opt
err = in.GetStructMissingOK("vfsOpt", &vfsOpt)
if err != nil {
fmt.Println(err)
return nil, err
}
mountOpt := mountlib.Options{AllowOther: true}
err = in.GetStructMissingOK("mountOpt", &mountOpt)
if err != nil {
fmt.Println(err)
return nil, err
}
mountType, err := in.GetString("mountType")
mountMu.Lock()
defer mountMu.Unlock()
if err != nil {
mountType = ""
}
mountType, mountFn := mountlib.ResolveMountMethod(mountType)
if mountFn == nil {
return nil, errors.New("mount Option specified is not registered, or is invalid")
}
// Get Fs.fs to be mounted from fs parameter in the params
fdst, err := rc.GetFs(ctx, in)
if err != nil {
fmt.Println(err)
return nil, err
}
mnt := mountlib.NewMountPoint(mountFn, mountPoint, fdst, &mountOpt, &vfsOpt)
_, err = mnt.Mount()
if err != nil {
log.Printf("mount FAILED: %v", err)
return nil, err
}
// Add mount to list if mount point was successfully created
liveMounts[mountPoint] = mnt
fmt.Println(nil, "Mount for %s created at %s using %s", fdst.String(), mountPoint, mountType) //TODO: Remove this line
return nil, nil
}