Skip to content

Commit

Permalink
chore: add sgx flag for function deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
theBeardA committed Sep 4, 2024
1 parent 54295eb commit 5dbb519
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
"noBundle": "Disable bundling",
"bundleDisabledInDirectory": "Bundling is disabled but the path points to a directory. The {filename} file will be uploaded.",
"functionDeployToPrivateStorage": "[🧪 Alpha] Function code will be private",
"functionsUseSgx": "[🧪 Alpha] Function will use trusted execution environment for sensitive computations",
"environmentVariables": "Set environment variables, do not include any sensitive information if your function is not private!",
"environmentVariablesFile": "Set environment variables from a file, do not include any sensitive information if your function is not private!",
"missingEnvVar": "Environment variable {key} is missing",
Expand All @@ -340,4 +341,4 @@
"requireDeprecatedUseES6Syntax": "The use of 'require' is deprecated in this context. Please switch to using ES6 'import' syntax for module imports. For example, change 'require' to 'import <ModuleName> from '<ModulePath>';'. This adjustment is necessary to comply with modern JavaScript standards and improve compatibility with Fleek Functions runtime and environment.",
"expectedNotFoundGeneric": "We had trouble locating the {name}. Please try again, and contact us if the issue persists.",
"unexpectedFileFormat": "We weren't expecting the format {format}. Please report the issue to our team and provide details for a quick fix."
}
}
4 changes: 3 additions & 1 deletion src/commands/functions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type DeployActionArgs = {
private: boolean;
env: string[];
envFile?: string;
sgx?: boolean;
};

const deployAction: SdkGuardedFunction<DeployActionArgs> = async ({
Expand All @@ -31,6 +32,7 @@ const deployAction: SdkGuardedFunction<DeployActionArgs> = async ({
const functionToDeploy = await getFunctionOrPrompt({ name: args.name, sdk });
const filePath = await getFunctionPathOrPrompt({ path: args.filePath });
const bundle = !args.noBundle;
const sgx = args.sgx ?? false;
const bundledFilePath = await getCodeFromPath({
filePath,
bundle,
Expand Down Expand Up @@ -111,7 +113,7 @@ const deployAction: SdkGuardedFunction<DeployActionArgs> = async ({

await sdk
.functions()
.deploy({ functionId: functionToDeploy.id, cid: uploadResult.pin.cid });
.deploy({ functionId: functionToDeploy.id, cid: uploadResult.pin.cid, sgx });

output.success(t('commonNameCreateSuccess', { name: 'deployment' }));
output.printNewLine();
Expand Down
3 changes: 3 additions & 0 deletions src/commands/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type DeployOptions = {
private: boolean;
env?: string[];
envFile?: string;
sgx?: boolean;
};

export default (program: Command) => {
Expand Down Expand Up @@ -69,6 +70,7 @@ export default (program: Command) => {
.option('--noBundle', t('noBundle'), false)
.option('--private', t('functionDeployToPrivateStorage'), false)
.option('-e, --env <environmentVariables...>', t('environmentVariables'))
.option('--sgx', t('functionsUseSgx'), false)
.option(
'--envFile <environmentVariablesFilePath>',
t('environmentVariablesFile'),
Expand All @@ -81,6 +83,7 @@ export default (program: Command) => {
private: options.private,
env: options.env ?? [],
envFile: options.envFile,
sgx: options.sgx
}),
);

Expand Down

0 comments on commit 5dbb519

Please sign in to comment.