diff --git a/.env-template b/.env-template index 619a4a3..a005198 100644 --- a/.env-template +++ b/.env-template @@ -1,7 +1,7 @@ GITHUB_TOKEN= # Uses the default azurite storage account # For more information, see https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator#authorize-with-shared-key-credentials -STORAGE_KEY="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;" +STORAGE_ACCOUNT_CON_STRING="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;" WEEKLY_RETENTION=1 GITHUB_ORG=equinor BLOB_CONTAINER=github-archives diff --git a/README.md b/README.md index 0c61897..d6e090f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ ms-continuus is configured entirely with environment variables. |MONTHLY_RETENTION:|230|Delete blobs with retentionClass='monthly' older than n-days| |YEARLY_RETENTION:|420|Delete blobs with retentionClass='yearly' older than n-days| |GITHUB_TOKEN:|null|Required: Github Personal Access Token| - |STORAGE_KEY:|null|Required: Azure StorageAccount ConnectionString| + |STORAGE_ACCOUNT_CON_STRING:|null|Required: Azure StorageAccount ConnectionString| ## (TODO: Waiting for Blob Idex Tags Preview Feature) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 669f9bb..56e89cd 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -4,7 +4,7 @@ services: ms-continuus: environment: GITHUB_URL: http://mock-api:5000 - STORAGE_KEY: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://storage-emulator:10000/devstoreaccount1; + STORAGE_ACCOUNT_CON_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://storage-emulator:10000/devstoreaccount1; depends_on: - storage-emulator diff --git a/docker-compose.yaml b/docker-compose.yaml index 4e784d1..1fed195 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,4 +10,4 @@ services: BLOB_CONTAINER: github-archives WEEKLY_RETENTION: 60 GITHUB_TOKEN: ${GITHUB_TOKEN} - STORAGE_KEY: ${STORAGE_KEY} + STORAGE_ACCOUNT_CON_STRING: ${STORAGE_ACCOUNT_CON_STRING} diff --git a/mock_api/Dockerfile b/mock_api/Dockerfile index e946a24..dfe19bb 100644 --- a/mock_api/Dockerfile +++ b/mock_api/Dockerfile @@ -1,4 +1,4 @@ -FROM python +FROM python:3.10 WORKDIR /app ADD . /app RUN pip install poetry diff --git a/src/BlobStorage.cs b/src/BlobStorage.cs index 27470a6..f273936 100644 --- a/src/BlobStorage.cs +++ b/src/BlobStorage.cs @@ -12,7 +12,7 @@ namespace ms_continuus public class BlobStorage { private static readonly Config Config = new(); - private static readonly BlobServiceClient BlobServiceClient = new(Config.StorageKey); + private static readonly BlobServiceClient BlobServiceClient = new(Config.StorageAccountConnectionString); private BlobContainerClient _containerClient; public async Task EnsureContainer() diff --git a/src/Config.cs b/src/Config.cs index 67d510a..6a6da61 100644 --- a/src/Config.cs +++ b/src/Config.cs @@ -42,8 +42,8 @@ public Config() Console.WriteLine( "WARNING: Environment variable 'GITHUB_TOKEN' not set. Will continue operating on public repositories only"); - StorageKey = Environment.GetEnvironmentVariable("STORAGE_KEY"); - if (StorageKey == null) throw new Exception("Environment variable 'STORAGE_KEY' missing"); + StorageAccountConnectionString = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT_CON_STRING"); + if (StorageAccountConnectionString == null) throw new Exception("Environment variable 'STORAGE_ACCOUNT_CON_STRING' missing"); } public string Organization { get; } @@ -54,7 +54,7 @@ public Config() public int MonthlyRetention { get; } public int YearlyRetention { get; } public string GithubToken { get; } - public string StorageKey { get; } + public string StorageAccountConnectionString { get; } public override string ToString() {