mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
Tweaks to rclone authorize
* Document the headless / remote setup procedure * Move Config constants into fs * Parse arguments in main for Authorize
This commit is contained in:
34
fs/config.go
34
fs/config.go
@@ -26,6 +26,18 @@ import (
|
||||
|
||||
const (
|
||||
configFileName = ".rclone.conf"
|
||||
|
||||
// ConfigToken is the key used to store the token under
|
||||
ConfigToken = "token"
|
||||
|
||||
// ConfigClientID is the config key used to store the client id
|
||||
ConfigClientID = "client_id"
|
||||
|
||||
// ConfigClientSecret is the config key used to store the client secret
|
||||
ConfigClientSecret = "client_secret"
|
||||
|
||||
// ConfigAutomatic indicates that we want non-interactive configuration
|
||||
ConfigAutomatic = "config_automatic"
|
||||
)
|
||||
|
||||
// SizeSuffix is parsed by flag with k/M/G suffixes
|
||||
@@ -533,21 +545,13 @@ func EditConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
// Duplicated from oauthutil to avoid circular reference.
|
||||
const (
|
||||
// ConfigClientID is the config key used to store the client id
|
||||
ConfigClientID = "client_id"
|
||||
|
||||
// ConfigClientSecret is the config key used to store the client secret
|
||||
ConfigClientSecret = "client_secret"
|
||||
|
||||
// ConfigAutomatic indicates that we want non-interactive configuration
|
||||
ConfigAutomatic = "config_automatic"
|
||||
)
|
||||
|
||||
// Authorize is for remote authorization of headless machines.
|
||||
func Authorize() {
|
||||
args := pflag.Args()[1:]
|
||||
//
|
||||
// It expects 1 or 3 arguments
|
||||
//
|
||||
// rclone authorize "fs name"
|
||||
// rclone authorize "fs name" "client id" "client secret"
|
||||
func Authorize(args []string) {
|
||||
switch len(args) {
|
||||
case 1, 3:
|
||||
default:
|
||||
@@ -560,7 +564,7 @@ func Authorize() {
|
||||
}
|
||||
|
||||
if fs.Config == nil {
|
||||
log.Fatalf("No configuration on fs %v", newType)
|
||||
log.Fatalf("Can't authorize fs %q", newType)
|
||||
}
|
||||
// Name used for temporary fs
|
||||
name := "**temp-fs**"
|
||||
|
||||
Reference in New Issue
Block a user