1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package scp
import (
"github.com/viant/toolbox/cred"
"github.com/viant/toolbox/secret"
"github.com/viant/toolbox/storage"
"strings"
)
//ProviderScheme represents scp URL scheme for this provider
const ProviderScheme = "scp"
//SSHProviderScheme represents ssh URL scheme for this provider
const SSHProviderScheme = "ssh"
func init() {
storage.Registry().Registry[ProviderScheme] = serviceProvider
storage.Registry().Registry[SSHProviderScheme] = serviceProvider
}
func serviceProvider(credentials string) (storage.Service, error) {
var config = &cred.Config{}
if strings.TrimSpace(credentials) != "" {
var err error
secrets := secret.New("", false)
config, err = secrets.GetCredentials(credentials)
if err != nil {
return nil, err
}
}
return NewService(config), nil
}
|