Skip to content

Commit 5fe0bd2

Browse files
committed
refactor: Removing self-hosted from login
1 parent dea75b4 commit 5fe0bd2

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

templates/cli/lib/commands/generic.js.twig

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,16 @@ const { globalConfig, localConfig } = require("../config");
66
const { actionRunner, success, parseBool, commandDescriptions, error, parse, log, drawTable } = require("../parser");
77
const ID = require("../id");
88
{% if sdk.test != "true" %}
9-
const { questionsLogin, questionLoginWithEndpoint, questionsLogout, questionsListFactors, questionsMfaChallenge } = require("../questions");
10-
const { accountCreate, accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
9+
const { questionsLogin, questionsLogout, questionsListFactors, questionsMfaChallenge } = require("../questions");
10+
const { accountUpdateMfaChallenge, accountCreateMfaChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
1111

1212
const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
1313

14-
const loginCommand = async ({ selfHosted, email, password, endpoint, mfa, code }) => {
14+
const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
1515
const oldCurrent = globalConfig.getCurrentLogin();
16-
let answers = {};
17-
let configEndpoint = DEFAULT_ENDPOINT;
18-
19-
if (selfHosted) {
20-
answers = endpoint && email && password ? { endpoint, email, password } : await inquirer.prompt(questionLoginWithEndpoint);
21-
configEndpoint = answers.endpoint;
22-
} else {
23-
answers = email && password ? { email, password } : await inquirer.prompt(questionsLogin);
24-
}
16+
let configEndpoint = endpoint ?? DEFAULT_ENDPOINT;
2517

18+
const answers = email && password ? { email, password } : await inquirer.prompt(questionsLogin);
2619

2720
if (answers.method === 'select') {
2821
const accountId = answers.accountId;
@@ -138,7 +131,6 @@ const whoami = new Command("whoami")
138131

139132
const login = new Command("login")
140133
.description(commandDescriptions['login'])
141-
.option(`-sh, --self-hosted`, `Flag for enabling custom endpoint for self hosted instances`)
142134
.option(`--email [email]`, `User email`)
143135
.option(`--password [password]`, `User password`)
144136
.option(`--endpoint [endpoint]`, `Appwrite endpoint for self hosted instances`)

0 commit comments

Comments
 (0)