Skip to content

Commit

Permalink
Create container if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-Juhasz committed Jul 27, 2019
1 parent 4653e4e commit ff6c5f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PhotoArchiver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ static async Task Main(string[] args)
// initialize
var archiver = serviceProvider.GetRequiredService<Archiver>();
var options = serviceProvider.GetRequiredService<IOptions<Options>>();
var client = serviceProvider.GetRequiredService<CloudBlobClient>();
var logger = serviceProvider.GetRequiredService<ILogger<Program>>();

logger.LogTrace("Ensure container exists...");
if (await client.GetContainerReference(options.Value.Container).CreateIfNotExistsAsync())
{
logger.LogInformation("Container created.");
}

// start
var result = await archiver.ArchiveAsync(options.Value.Path);
Expand Down

0 comments on commit ff6c5f3

Please sign in to comment.