Skip to content

Commit

Permalink
Merge pull request #2462 from IDEMSInternational/fix/encrypted-deploy…
Browse files Browse the repository at this point in the history
…ment-set

fix: encrypted deployment set
  • Loading branch information
chrismclarke authored Oct 9, 2024
2 parents 3f6ff1c + 641971a commit d987c2c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/scripts/src/commands/deployment/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class DeploymentSet {
}
}

private async promptDeploymentSelect() {
public async promptDeploymentSelect() {
const deploymentNames = fs
.readdirSync(DEPLOYMENTS_PATH, { withFileTypes: true })
.filter((d) => d.isDirectory())
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/src/commands/deployment/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function parseConfigJson(json: IDeploymentConfigJson) {
/**
* Decide if a config needs recompiling by checking if modified timestamps
* on the .ts and .json files are the same (applied during compilation)
* TODO - also consider files from encrypted or other imports (e.g. skins)
*/
function isConfigUpToDate(tsPath: string, jsonPath: string) {
const json = fs.readJSONSync(jsonPath) as IDeploymentConfigJson;
Expand Down
22 changes: 16 additions & 6 deletions packages/workflows/src/deployment.workflows.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeploymentSet } from "../../scripts/src/commands/deployment/set";
import type { IDeploymentWorkflows } from "./workflow.model";
/** Default workflows made available to all deployments */
const workflows: IDeploymentWorkflows = {
Expand Down Expand Up @@ -85,17 +86,26 @@ const workflows: IDeploymentWorkflows = {
],
label: "Set active deployment",
steps: [
// Prompt deployment name if not specified
{
name: "deployment set",
function: async ({ tasks, args }) => {
await tasks.deployment.set(args[0]);
name: "deployment prompt",
condition: async ({ args }) => !args[0],
function: async ({ args }) => {
const deploymentName = await new DeploymentSet().promptDeploymentSelect();
args[0] = deploymentName;
},
},
// Ensure deployment decrypted once set
// Attempt to decrypt config before setting (so that it can populate to config json)
{
name: "decrypt",
function: async ({ tasks }) => {
await tasks.encryption.decrypt();
function: async ({ tasks, args }) => {
await tasks.encryption.decrypt(args[0]);
},
},
{
name: "deployment set",
function: async ({ tasks, args }) => {
await tasks.deployment.set(args[0]);
},
},
{
Expand Down

0 comments on commit d987c2c

Please sign in to comment.