Skip to content

Commit 82aed68

Browse files
committed
feat: update authentication method to use x-api-key header
- Replace Bearer token authentication with x-api-key header across all commands - Update token verification endpoints from auth.verifyToken to user.get - Remove unnecessary console.log debug statements - Bump version to v0.2.7
1 parent 21dd3f0 commit 82aed68

File tree

30 files changed

+40
-83
lines changed

30 files changed

+40
-83
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@dokploy/cli",
33
"description": "A CLI to manage dokploy server remotely",
4-
"version": "v0.2.6",
4+
"version": "v0.2.7",
55
"author": "Mauricio Siu",
66
"licenses": [{
77
"type": "MIT",

src/commands/app/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default class AppCreate extends Command {
132132
},
133133
{
134134
headers: {
135-
Authorization: `Bearer ${auth.token}`,
135+
"x-api-key": auth.token,
136136
"Content-Type": "application/json",
137137
},
138138
},

src/commands/app/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default class AppDelete extends Command {
107107
},
108108
{
109109
headers: {
110-
Authorization: `Bearer ${auth.token}`,
110+
"x-api-key": auth.token,
111111
"Content-Type": "application/json",
112112
},
113113
},

src/commands/app/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default class AppDeploy extends Command {
107107
},
108108
{
109109
headers: {
110-
Authorization: `Bearer ${auth.token}`,
110+
"x-api-key": auth.token,
111111
"Content-Type": "application/json",
112112
},
113113
},

src/commands/app/stop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class AppStop extends Command {
102102
},
103103
{
104104
headers: {
105-
Authorization: `Bearer ${auth.token}`,
105+
"x-api-key": auth.token,
106106
"Content-Type": "application/json",
107107
},
108108
},

src/commands/authenticate.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,11 @@ export default class Authenticate extends Command {
8383
try {
8484
console.log(`\n${chalk.blue("Validating server...")}`);
8585

86-
await axios.post(
87-
`${url}/api/trpc/auth.verifyToken`,
88-
{},
86+
await axios.get(
87+
`${url}/api/trpc/user.get`,
8988
{
9089
headers: {
91-
Authorization: `Bearer ${token}`,
90+
"x-api-key": token,
9291
"Content-Type": "application/json",
9392
},
9493
},
@@ -104,3 +103,7 @@ export default class Authenticate extends Command {
104103
}
105104
}
106105
}
106+
// curl -X 'GET' \
107+
// 'https://panel.jinza.app/api/project.all' \
108+
// -H 'accept: application/json' \
109+
// -H 'x-api-key: EawCkTREMhxoAqvCxJFZurgCGoDZPjYHHrLgUPghRjJTpXLaahFdhCOGfABZXTRP'

src/commands/database/mariadb/create.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,6 @@ export default class DatabaseMariadbCreate extends Command {
182182
}
183183

184184
try {
185-
console.log(JSON.stringify({
186-
name,
187-
databaseName,
188-
description,
189-
databaseRootPassword,
190-
databasePassword,
191-
databaseUser,
192-
dockerImage,
193-
appName,
194-
projectId,
195-
}, null, 2));
196185
const response = await axios.post(
197186
`${auth.url}/api/trpc/mariadb.create`,
198187
{
@@ -210,7 +199,7 @@ export default class DatabaseMariadbCreate extends Command {
210199
},
211200
{
212201
headers: {
213-
Authorization: `Bearer ${auth.token}`,
202+
"x-api-key": auth.token,
214203
"Content-Type": "application/json",
215204
},
216205
},

src/commands/database/mariadb/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class DatabaseMariadbDelete extends Command {
102102
},
103103
{
104104
headers: {
105-
Authorization: `Bearer ${auth.token}`,
105+
"x-api-key": auth.token,
106106
"Content-Type": "application/json",
107107
},
108108
},

src/commands/database/mariadb/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class DatabaseMariadbDeploy extends Command {
103103
},
104104
{
105105
headers: {
106-
Authorization: `Bearer ${auth.token}`,
106+
"x-api-key": auth.token,
107107
"Content-Type": "application/json",
108108
},
109109
},

src/commands/database/mariadb/stop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class DatabaseMariadbStop extends Command {
103103
},
104104
{
105105
headers: {
106-
Authorization: `Bearer ${auth.token}`,
106+
"x-api-key": auth.token,
107107
"Content-Type": "application/json",
108108
},
109109
},

0 commit comments

Comments
 (0)