mirror of
https://github.com/Dokploy/cli.git
synced 2026-06-15 20:25:22 +02:00
Merge pull request #10 from Sebbev/fix/pull-and-push-command
Add environment selection for env pull and push commands
This commit is contained in:
16
src/commands/env/pull.ts
vendored
16
src/commands/env/pull.ts
vendored
@@ -53,12 +53,24 @@ export default class EnvPull extends Command {
|
||||
const projectId = project.projectId;
|
||||
const projectSelected = await getProject(projectId, auth, this);
|
||||
|
||||
const {environment} = await inquirer.prompt<any>([
|
||||
{
|
||||
choices: projectSelected.environments.map((environment: any) => ({
|
||||
name: environment.name,
|
||||
value: environment,
|
||||
})),
|
||||
message: "Select the environment:",
|
||||
name: "environment",
|
||||
type: "list",
|
||||
},
|
||||
]);
|
||||
|
||||
const choices = [
|
||||
...projectSelected.applications.map((app: any) => ({
|
||||
...environment.applications.map((app: any) => ({
|
||||
name: `${app.name} (Application)`,
|
||||
value: app.env,
|
||||
})),
|
||||
...projectSelected.compose.map((compose: any) => ({
|
||||
...environment.compose.map((compose: any) => ({
|
||||
name: `${compose.name} (Compose)`,
|
||||
value: compose.env,
|
||||
})),
|
||||
|
||||
18
src/commands/env/push.ts
vendored
18
src/commands/env/push.ts
vendored
@@ -59,12 +59,24 @@ export default class EnvPush extends Command {
|
||||
const projectId = project.projectId;
|
||||
const projectSelected = await getProject(projectId, auth, this);
|
||||
|
||||
const {environment} = await inquirer.prompt<any>([
|
||||
{
|
||||
choices: projectSelected.environments.map((environment: any) => ({
|
||||
name: environment.name,
|
||||
value: environment,
|
||||
})),
|
||||
message: "Select the environment:",
|
||||
name: "environment",
|
||||
type: "list",
|
||||
},
|
||||
]);
|
||||
|
||||
const choices = [
|
||||
...projectSelected.applications.map((app: any) => ({
|
||||
...environment.applications.map((app: any) => ({
|
||||
name: `${app.name} (Application)`,
|
||||
value: {serviceType: 'app', service: app},
|
||||
})),
|
||||
...projectSelected.compose.map((compose: any) => ({
|
||||
...environment.compose.map((compose: any) => ({
|
||||
name: `${compose.name} (Compose)`,
|
||||
value: {serviceType: 'compose', service: compose}
|
||||
})),
|
||||
@@ -72,7 +84,7 @@ export default class EnvPush extends Command {
|
||||
const {result: {serviceType, service}} = await inquirer.prompt<any>([
|
||||
{
|
||||
choices,
|
||||
message: "Select a service to pull the environment variables:",
|
||||
message: "Select a service to push the environment variables:",
|
||||
name: "result",
|
||||
type: "list",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user