diff options
author | Girish Ramakrishnan <girish@cloudron.io> | 2019-10-17 21:41:08 -0700 |
---|---|---|
committer | Girish Ramakrishnan <girish@cloudron.io> | 2019-10-17 21:41:08 -0700 |
commit | 38932f15c25f28296b53ee2d7ce738a20c9f7b15 (patch) | |
tree | 4a215ac52cc7fbec9db391292b70dad42326ec46 | |
parent | f14ea69e2a6b751fd515929a1fc439197ab67523 (diff) | |
download | Surfer-38932f15c25f28296b53ee2d7ce738a20c9f7b15.tar.gz Surfer-38932f15c25f28296b53ee2d7ce738a20c9f7b15.tar.zst Surfer-38932f15c25f28296b53ee2d7ce738a20c9f7b15.zip |
Add https:// to --server if required
-rw-r--r-- | cli/actions.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/actions.js b/cli/actions.js index e5d1731..0c621f6 100644 --- a/cli/actions.js +++ b/cli/actions.js | |||
@@ -29,12 +29,19 @@ function checkConfig(options) { | |||
29 | process.exit(1); | 29 | process.exit(1); |
30 | } | 30 | } |
31 | 31 | ||
32 | if (options.parent.server) { | ||
33 | var tmp = url.parse(options.parent.server); | ||
34 | if (!tmp.slashes) tmp = url.parse('https://' + options.parent.server); | ||
35 | gServer = tmp.protocol + '//' + tmp.host; | ||
36 | } else { | ||
37 | gServer = config.server(); | ||
38 | } | ||
39 | |||
32 | if (!options.parent.token && !config.accessToken()) { | 40 | if (!options.parent.token && !config.accessToken()) { |
33 | console.log('Run %s first or provide %s', 'surfer login'.bold, '--token <access token>'.bold); | 41 | console.log('Run %s first or provide %s', 'surfer login'.bold, '--token <access token>'.bold); |
34 | process.exit(1); | 42 | process.exit(1); |
35 | } | 43 | } |
36 | 44 | ||
37 | gServer = options.parent.server || config.server(); | ||
38 | gQuery = { access_token: options.parent.token || config.accessToken() }; | 45 | gQuery = { access_token: options.parent.token || config.accessToken() }; |
39 | 46 | ||
40 | console.error('Using server %s', gServer.cyan); | 47 | console.error('Using server %s', gServer.cyan); |