Skip to content

Commit

Permalink
- 2023-07-28 - BryanSoltis - v3.0.0 Updates
Browse files Browse the repository at this point in the history
- Updated project to .NET 7
- Updated Docker images to .NET 7
- Added Environment Details to Admin page
  • Loading branch information
BryanSoltis committed Jul 28, 2023
1 parent d4e099f commit 13f40f7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/AzureNamingTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Version>3.0.0</Version>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>8d243b16-78f2-4542-8f36-682411560b1a</UserSecretsId>
Expand All @@ -19,6 +19,13 @@
<NoWarn>1591;1701;1702</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="VersionNotes\**" />
<Content Remove="VersionNotes\**" />
<EmbeddedResource Remove="VersionNotes\**" />
<None Remove="VersionNotes\**" />
</ItemGroup>

<ItemGroup>
<Content Remove="appsettings.Development.json" />
<Content Remove="appsettings.json" />
Expand Down Expand Up @@ -59,6 +66,7 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Runtime.Caching" Version="7.0.0" />
</ItemGroup>

Expand All @@ -80,7 +88,6 @@
<ItemGroup>
<Folder Include="Properties\PublishProfiles\" />
<Folder Include="Properties\ServiceDependencies\" />
<Folder Include="VersionNotes\" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["AzureNamingTool.csproj", "."]
RUN dotnet restore "./AzureNamingTool.csproj"
Expand Down
19 changes: 19 additions & 0 deletions src/Helpers/ConfigurationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using System;
using Blazored.Toast.Services;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Collections;

namespace AzureNamingTool.Helpers
{
Expand Down Expand Up @@ -837,7 +839,24 @@ public static async Task SyncConfigurationData(string type)
{
AdminLogService.PostItem(new AdminLogMessage() { Title = "ERROR", Message = ex.Message });
}
}

public static List<KeyValuePair<string,string>> GetEnvironmentVariables()
{
List<KeyValuePair<string, string>> result = new();
try
{
var entries = Environment.GetEnvironmentVariables().Cast<DictionaryEntry>()
.Select(x => KeyValuePair.Create((string)x.Key, (string)x.Value!));
var sortedEntries = entries.OrderBy(x => x.Key);
result = sortedEntries.ToList<KeyValuePair<string, string>>();
return result;
}
catch (Exception ex)
{
AdminLogService.PostItem(new AdminLogMessage() { Title = "ERROR", Message = ex.Message });
}
return result;
}
}
}
23 changes: 23 additions & 0 deletions src/Pages/Admin.razor
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@
</div>
</div>
}
@if (GeneralHelper.IsNotNull(environmentvariables))
{
<div class="card mb-3" style="width:auto;">
<div class="card-header bg-default text-dark">
<a id="environmentvariableslink" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#environmentvariables" role="button" aria-expanded="false" aria-controls="environmentvariables">
<span class="oi oi-chevron-bottom" aria-hidden="true"></span> <strong>Environment Details</strong>
</a>
</div>
<div class="collapse card card-body @theme.ThemeStyle" id="environmentvariables">
<div class="mb-3">
<ul>
@foreach(var variable in environmentvariables)
{
<li>@variable.Key: @variable.Value</li>
}
</ul>
</div>

</div>
</div>
}
<div class="mb-3">
<button type="button" class="btn btn-success" @onclick="@(e => SubmitIssue("feature"))" title="Feature Request">Feature Request</button>
<button type="button" class="btn btn-danger" @onclick="@(e => SubmitIssue("bug"))" title="Submit a bug">Submit a bug</button>
Expand Down Expand Up @@ -427,6 +448,7 @@
private string appversion = String.Empty;
private SiteConfiguration config = ConfigurationHelper.GetConfigurationData();
private string currentuser = String.Empty;
private List<KeyValuePair<string, string>> environmentvariables = new();

protected override async Task OnAfterRenderAsync(bool firstRender)
{
Expand Down Expand Up @@ -461,6 +483,7 @@
currentidentityprovider = identityProviderDetails.CurrentIdentityProvider;
}
}
environmentvariables = ConfigurationHelper.GetEnvironmentVariables();
}

await storage.SetAsync("apptheme", theme.ThemeStyle);
Expand Down
7 changes: 7 additions & 0 deletions src/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:51656;http://localhost:51657"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}

0 comments on commit 13f40f7

Please sign in to comment.