Skip to content

Commit 2c8b276

Browse files
author
Manus AI
committed
feat: Add --host parameter support to login command
Added --host/-h option to the login command to support authentication against self-hosted Fleetbase instances. Features: - Accepts full URL with protocol (http:// or https://) - Auto-adds https:// if protocol is missing - Constructs registry URL from host automatically - Falls back to https://api.fleetbase.io if not specified Usage: flb login -u username -p password -e email@example.com flb login -u username -p password -e email@example.com --host http://localhost:8000 flb login -u username -p password -e email@example.com --host myinstance.com This completes the self-hosted authentication flow: 1. flb register --host <host> 2. flb verify -e <email> -c <code> --host <host> 3. flb login -u <username> -p <password> -e <email> --host <host>
1 parent 26cdd4a commit 2c8b276

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,15 @@ function loginCommand (options) {
12041204
const username = options.username;
12051205
const password = options.password;
12061206
const email = options.email;
1207-
const registry = options.registry || defaultRegistry;
1207+
const host = options.host || 'https://api.fleetbase.io';
1208+
1209+
// Ensure host has protocol
1210+
const apiHost = host.startsWith('http://') || host.startsWith('https://')
1211+
? host
1212+
: `https://${host}`;
1213+
1214+
// Construct registry URL from host
1215+
const registry = options.registry || `${apiHost}/registry/v1`;
12081216
const scope = options.scope || '';
12091217
const quotes = options.quotes || '';
12101218
const configPath = options.configPath || '';
@@ -1391,6 +1399,7 @@ program
13911399
.option('-u, --username <username>', 'Username for the registry')
13921400
.option('-p, --password <password>', 'Password for the registry')
13931401
.option('-e, --email <email>', 'Email associated with your account')
1402+
.option('-h, --host <host>', 'API host with protocol (default: https://api.fleetbase.io)')
13941403
.option('-r, --registry <registry>', 'Registry URL', defaultRegistry)
13951404
.option('--scope <scope>', 'Scope for the registry')
13961405
.option('--quotes <quotes>', 'Quotes option for npm-cli-login')

0 commit comments

Comments
 (0)