sparse-intern-71089
09/01/2022, 11:49 AMechoing-dinner-19531
09/01/2022, 12:05 PMimportant-holiday-25047
09/01/2022, 12:45 PMimportant-holiday-25047
09/01/2022, 12:46 PMripe-russia-4239
09/01/2022, 1:00 PMimportant-holiday-25047
09/01/2022, 1:05 PMimportant-holiday-25047
09/01/2022, 1:06 PMexport const documentStorage = createStorage({
parentKey: "DocumentStorage",
name: "bsdocuments",
receiveAccount: a => documentStorageAccount= a
});
important-holiday-25047
09/01/2022, 1:06 PMexport const documentStorage = createStorage({
parentKey: "DocumentStorage",
name: "bsdocuments",
corsRules: !isProduction() ?
[
{
allowedHeaders: ["*"],
allowedMethods: ["GET", "POST", "PUT"],
allowedOrigins: ["*"],
exposedHeaders: ["*"],
maxAgeInSeconds: 60,
}
] : [],
receiveAccount: a => documentStorageAccount= a
});
echoing-dinner-19531
09/01/2022, 1:09 PMimportant-holiday-25047
09/01/2022, 1:09 PMimportant-holiday-25047
09/01/2022, 1:32 PMname : "default" => Output<T>
type : "Microsoft.Storage/storageAccounts/blobServices" => Output<T>
I changed it now so the cors is set as the last parameter in the parameter object, now I have no diff anymore, but still the same errorechoing-dinner-19531
09/01/2022, 1:34 PMechoing-dinner-19531
09/01/2022, 1:36 PMimportant-holiday-25047
09/02/2022, 7:53 AMfunction createStorage(args: IStorageSettings): ISetting[] {
const storageAccount= createStorageAccount(args.name, args.corsRules);
if (args.receiveAccount)
args.receiveAccount(storageAccount);
const connectionString = createConnectionString(storageAccount);
const appSettingsKey= `${args.parentKey}__ConnectionString`;
return [
{
name: appSettingsKey,
value: connectionString
}
];
}
function createStorageAccount(name: string, corsRules?: types.input.storage.CorsRuleArgs[], resourceGrp?: string): storage.StorageAccount {
const result= new storage.StorageAccount(name, {
resourceGroupName: resourceGrp ?? resourceGroupName,
kind: storage.Kind.StorageV2,
sku: { name: storage.SkuName.Standard_RAGRS }
}, {protect: true});
if (corsRules) {
new storage.BlobServiceProperties("blobServiceProperties", {
accountName: result.name,
blobServicesName: "default",
cors: {
corsRules
},
defaultServiceVersion: "2017-07-29",
resourceGroupName: resourceGroupName,
});
}
return result;
}
Those are the 2 methods that are used to create the storageechoing-dinner-19531
09/02/2022, 9:25 AMShouldn't that make use of "name" as well to make sure it's unique? Call this method twice and you'll get two objects called "blobServiceProperties"Copy codenew storage.BlobServiceProperties("blobServiceProperties", {
important-holiday-25047
09/02/2022, 10:16 AM