mirror of
https://github.com/Dokploy/cli.git
synced 2026-06-15 20:25:22 +02:00
feat: add check server command
This commit is contained in:
29
src/commands/authenticate.ts
Normal file
29
src/commands/authenticate.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Command, Flags } from "@oclif/core";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
||||
const configPath = path.join(__dirname, "..", "..", "config.json");
|
||||
|
||||
export default class Authenticate extends Command {
|
||||
static description = "Authenticate the user by saving server URL and token";
|
||||
|
||||
static flags = {
|
||||
token: Flags.string({
|
||||
char: "t",
|
||||
description: "Authentication token",
|
||||
required: true,
|
||||
}),
|
||||
url: Flags.string({ char: "u", description: "Server URL", required: true }),
|
||||
};
|
||||
|
||||
async run() {
|
||||
const { flags } = await this.parse(Authenticate);
|
||||
const config = {
|
||||
token: flags.token,
|
||||
url: flags.url,
|
||||
};
|
||||
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
this.log("Authentication details saved successfully.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user