-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7aa840
commit f169674
Showing
10 changed files
with
83 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...ages/internal/cli/src/commands/get-env.ts → .../internal/cli/src/commands/aws/get-env.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
import { assertAwsVaultInstalled } from '../../lib/awsVault'; | ||
|
||
export default class GetEnv extends Command { | ||
static description = 'Get currently selected ENV stage'; | ||
|
||
static examples = [`$ saas aws login`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, { requireAws: true }); | ||
await assertAwsVaultInstalled(); | ||
|
||
await runCommand('aws-vault', ['login']); | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...ages/internal/cli/src/commands/set-env.ts → .../internal/cli/src/commands/aws/set-env.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
import { assertDockerIsRunning } from '../../lib/docker'; | ||
|
||
export default class BackendUp extends Command { | ||
static description = 'Stops all backend services'; | ||
|
||
static examples = [`$ saas backend down`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, { requireLocalEnvStage: true }); | ||
await assertDockerIsRunning(); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'core:docker-compose:down']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { CLIError } from '@oclif/errors'; | ||
import * as childProcess from 'child_process'; | ||
import { promisify } from 'util'; | ||
import { lookpath } from 'lookpath'; | ||
|
||
const exec = promisify(childProcess.exec); | ||
|
||
export const isAwsVaultInstalled = async () => { | ||
return await lookpath('aws-vault'); | ||
}; | ||
|
||
export const assertAwsVaultInstalled = async () => { | ||
const isInstalled = await isAwsVaultInstalled(); | ||
if (!isInstalled) { | ||
throw new CLIError(`aws-vault executable not found. Make sure it is installed in the system and re-run the | ||
command. Go to https://github.com/99designs/aws-vault and learn how to install and configure it.`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { CLIError } from '@oclif/errors'; | ||
import * as childProcess from 'child_process'; | ||
import { promisify } from 'util'; | ||
import { lookpath } from 'lookpath'; | ||
|
||
const exec = promisify(childProcess.exec); | ||
|
||
export const isChamberInstalled = async () => { | ||
return await lookpath('chamber'); | ||
}; | ||
|
||
export const assertChamberInstalled = async () => { | ||
const isInstalled = await isChamberInstalled(); | ||
if (!isInstalled) { | ||
throw new CLIError(`chamber executable not found. Make sure it is installed in the system and re-run the | ||
command. Go to https://github.com/segmentio/chamber and learn how to install and configure it.`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters