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