Skip to content

Commit

Permalink
feat: add hosting creation and cors config
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko committed Sep 24, 2019
1 parent 2a02a2d commit 55ea5eb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/features/hosting/index.ts
Expand Up @@ -26,8 +26,21 @@ module.exports = async function() {
const storage: AzureStorage = Config.get("storage");
debug(`using storage ${chalk.green(JSON.stringify(storage))}`);

const subscription: AzureSubscription = Config.get("subscription");
debug(`using subscription ${chalk.green(JSON.stringify(subscription))}`);

// https://docs.microsoft.com/en-us/cli/azure/storage/blob/service-properties?view=azure-cli-latest#az-storage-blob-service-properties-update
await az(
`storage blob service-properties update --account-name ${storage.name} --static-website --404-document 404.html --index-document index.html`
`storage blob service-properties update --account-name "${storage.name}" --static-website --404-document 404.html --index-document index.html --query '{staticWebsite: staticWebsite}'`,
`Enabling hosting service...`
);

// https://docs.microsoft.com/en-us/cli/azure/storage/cors?view=azure-cli-latest#az-storage-cors-clear
await az(`storage cors clear --services "b" --account-name "${storage.name}" --subscription "${subscription.id}"`);
// https://docs.microsoft.com/en-us/cli/azure/storage/cors?view=azure-cli-latest#az-storage-cors-add
await az(
`storage cors add --methods GET HEAD MERGE OPTIONS POST PUT --origins "*" --services "b" --account-name "${storage.name}" --subscription "${subscription.id}" --max-age 3600`,
`Enabling CORS...`
);

saveWorkspace({
Expand Down

0 comments on commit 55ea5eb

Please sign in to comment.