From 38932f15c25f28296b53ee2d7ce738a20c9f7b15 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 17 Oct 2019 21:41:08 -0700 Subject: Add https:// to --server if required --- cli/actions.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cli') 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) { process.exit(1); } + if (options.parent.server) { + var tmp = url.parse(options.parent.server); + if (!tmp.slashes) tmp = url.parse('https://' + options.parent.server); + gServer = tmp.protocol + '//' + tmp.host; + } else { + gServer = config.server(); + } + if (!options.parent.token && !config.accessToken()) { console.log('Run %s first or provide %s', 'surfer login'.bold, '--token '.bold); process.exit(1); } - gServer = options.parent.server || config.server(); gQuery = { access_token: options.parent.token || config.accessToken() }; console.error('Using server %s', gServer.cyan); -- cgit v1.2.3