From ed619cdc17fdf158aeacf275824525602cc312e2 Mon Sep 17 00:00:00 2001 From: cswimr Date: Thu, 30 Jan 2025 17:58:13 +0000 Subject: [PATCH] chore(repo): rename from `myhm-commission` to `looking-glass` closes #4 --- .devcontainer/devcontainer.json | 7 ++++--- .vscode/launch.json | 4 ++-- .vscode/settings.json | 2 +- CONTRIBUTING.md | 4 ++-- ...nfiguration.cs => LookingGlassCOnfiguration.cs} | 4 ++-- Data/{MyhmContext.cs => LookingGlassContext.cs} | 5 +++-- Data/Moderation.cs | 2 +- Data/User.cs | 4 ++-- Dockerfile | 10 +++++----- LICENSE.md | 4 ++-- myhm-commission.csproj => LookingGlass.csproj | 2 +- myhm-commission.sln => LookingGlass.sln | 2 +- Program.cs | 14 +++++++------- README.md | 2 +- Util/RandomStringGenerator.cs | 2 +- Util/SwaggerTheme/CustomStyle.cs | 3 +-- docker-compose.dev.yml | 8 ++++---- docker-compose.yml | 14 +++++++------- 18 files changed, 47 insertions(+), 46 deletions(-) rename Data/{MyhmConfiguration.cs => LookingGlassCOnfiguration.cs} (87%) rename Data/{MyhmContext.cs => LookingGlassContext.cs} (83%) rename myhm-commission.csproj => LookingGlass.csproj (93%) rename myhm-commission.sln => LookingGlass.sln (84%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0636ba2..6aab7f9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ { - "name": "myhm-commission", + "name": "Looking Glass", "dockerComposeFile": "../docker-compose.dev.yml", - "service": "myhm-commission-dev", + "service": "looking-glass-dev", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "customizations": { "vscode": { @@ -23,7 +23,8 @@ "redhat.vscode-xml", "aaron-bond.better-comments", "donjayamanne.githistory", - "eamodio.gitlens" + "eamodio.gitlens", + "ms-azuretools.vscode-docker" ] } }, diff --git a/.vscode/launch.json b/.vscode/launch.json index 9f9f0d8..4d3aa2f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,10 +5,10 @@ "version": "0.2.0", "configurations": [ { - "name": "C#: myhm-commission", + "name": "C#: Looking Glass", "type": "dotnet", "request": "launch", - "projectPath": "${workspaceFolder}/myhm-commission.csproj" + "projectPath": "${workspaceFolder}/LookingGlass.csproj" } ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 6fea414..d10b38b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "dotnet.defaultSolution": "myhm-commission.sln", + "dotnet.defaultSolution": "LookingGlass.sln", "editor.formatOnSave": true, "[csharp]": { "editor.defaultFormatter": "csharpier.csharpier-vscode", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75ef032..ba835ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to $WIP +# Contributing to Looking Glass -Thanks for taking the time to contribute to $WIP! Please read through this document to ensure that your contribution is in compliance with our guidelines. We are excited to have you contribute to our project! +Thanks for taking the time to contribute to Looking Glass! Please read through this document to ensure that your contribution is in compliance with our guidelines. We are excited to have you contribute to our project! ## Conventional Commits diff --git a/Data/MyhmConfiguration.cs b/Data/LookingGlassCOnfiguration.cs similarity index 87% rename from Data/MyhmConfiguration.cs rename to Data/LookingGlassCOnfiguration.cs index 3ddc4c8..9e15524 100644 --- a/Data/MyhmConfiguration.cs +++ b/Data/LookingGlassCOnfiguration.cs @@ -1,6 +1,6 @@ -namespace Myhm.Data +namespace LookingGlass.Data { - public class MyhmConfiguration + public class ApplicationSettings { public required string AuthToken { get; init; } public required string DatabaseConnectionString { get; init; } diff --git a/Data/MyhmContext.cs b/Data/LookingGlassContext.cs similarity index 83% rename from Data/MyhmContext.cs rename to Data/LookingGlassContext.cs index cd53b87..ec6961f 100644 --- a/Data/MyhmContext.cs +++ b/Data/LookingGlassContext.cs @@ -1,9 +1,10 @@ using Microsoft.EntityFrameworkCore; using static EnumStringValues.EnumExtensions; -namespace Myhm.Data +namespace LookingGlass.Data { - public class MyhmContext(DbContextOptions options) : DbContext(options) + public class ApplicationContext(DbContextOptions options) + : DbContext(options) { public DbSet Moderation { get; set; } = default!; public DbSet User { get; set; } = default!; diff --git a/Data/Moderation.cs b/Data/Moderation.cs index fb218b4..f93d190 100644 --- a/Data/Moderation.cs +++ b/Data/Moderation.cs @@ -1,6 +1,6 @@ using EnumStringValues; -namespace Myhm.Data; +namespace LookingGlass.Data; public class Moderation { diff --git a/Data/User.cs b/Data/User.cs index 59430b2..4c71be1 100644 --- a/Data/User.cs +++ b/Data/User.cs @@ -1,4 +1,4 @@ -namespace Myhm.Data; +namespace LookingGlass.Data; public class User { @@ -9,7 +9,7 @@ public class User public bool WriteAccess { get; set; } = false; public bool Disabled { get; set; } = false; - public static User FromToken(string token, MyhmContext context) + public static User FromToken(string token, ApplicationContext context) { User user = context.User.First(u => u.Token == token) ?? throw new Exception("User not found"); diff --git a/Dockerfile b/Dockerfile index a95fcb6..d9953b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,17 +7,17 @@ EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:9.0@sha256:84fd557bebc64015e731aca1085b92c7619e49bdbe247e57392a43d92276f617 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["myhm-commission.csproj", "./"] -RUN dotnet restore "myhm-commission.csproj" +COPY ["LookingGlass.csproj", "./"] +RUN dotnet restore "LookingGlass.csproj" COPY . . WORKDIR "/src/" -RUN dotnet build "myhm-commission.csproj" -c $BUILD_CONFIGURATION -o /app/build +RUN dotnet build "LookingGlass.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "myhm-commission.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "LookingGlass.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "myhm-commission.dll"] +ENTRYPOINT ["dotnet", "LookingGlass.dll"] diff --git a/LICENSE.md b/LICENSE.md index d2af552..c2109e2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -209,7 +209,7 @@ If you develop a new program, and you want it to be of the greatest possible use To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. - myhm-commission + looking-glass Copyright (C) 2025 MYHM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. @@ -222,7 +222,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - myhm-commission Copyright (C) 2025 MYHM + looking-glass Copyright (C) 2025 MYHM This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/myhm-commission.csproj b/LookingGlass.csproj similarity index 93% rename from myhm-commission.csproj rename to LookingGlass.csproj index f658b88..b639c21 100644 --- a/myhm-commission.csproj +++ b/LookingGlass.csproj @@ -4,7 +4,7 @@ net9.0 enable enable - Myhm + LookingGlass Linux true $(NoWarn);1591 diff --git a/myhm-commission.sln b/LookingGlass.sln similarity index 84% rename from myhm-commission.sln rename to LookingGlass.sln index 9c56277..85ea650 100644 --- a/myhm-commission.sln +++ b/LookingGlass.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "myhm-commission", "myhm-commission.csproj", "{D39B0551-B762-4BD9-81DC-FF49FB7F8439}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LookingGlass", "LookingGlass.csproj", "{D39B0551-B762-4BD9-81DC-FF49FB7F8439}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Program.cs b/Program.cs index 81b78ba..ffa9be0 100644 --- a/Program.cs +++ b/Program.cs @@ -1,14 +1,14 @@ using System.Reflection; +using LookingGlass.Data; +using LookingGlass.Util.SwaggerTheme; using Microsoft.EntityFrameworkCore; using Microsoft.OpenApi.Models; -using Myhm.Data; -using Myhm.Util.SwaggerTheme; using Newtonsoft.Json; var builder = WebApplication.CreateBuilder(args); -var config = builder.Configuration.GetSection("Configuration").Get(); -builder.Services.Configure(builder.Configuration.GetSection("Configuration")); +var config = builder.Configuration.GetSection("Configuration").Get(); +builder.Services.Configure(builder.Configuration.GetSection("Configuration")); if ((config?.AuthToken?.Length ?? 0) < 64 && !builder.Environment.IsDevelopment()) { @@ -17,8 +17,8 @@ if ((config?.AuthToken?.Length ?? 0) < 64 && !builder.Environment.IsDevelopment( ); } -builder.Services.AddDbContextFactory(options => - options.UseNpgsql(builder.Configuration.GetConnectionString("MyhmContext")) +builder.Services.AddDbContextFactory(options => + options.UseNpgsql(builder.Configuration.GetConnectionString("ApplicationContext")) ); if (config?.UseSentry == true) @@ -34,7 +34,7 @@ builder.Services.AddSwaggerGen(opts => "v1", new OpenApiInfo { - Title = "Myhm API", + Title = "Looking Glass API", Version = "v1", Description = "", } diff --git a/README.md b/README.md index 9f368c1..93e10f7 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# myhm-commission +# looking-glass diff --git a/Util/RandomStringGenerator.cs b/Util/RandomStringGenerator.cs index 77e646f..d4ac152 100644 --- a/Util/RandomStringGenerator.cs +++ b/Util/RandomStringGenerator.cs @@ -1,7 +1,7 @@ using System.Security.Cryptography; using System.Text; -namespace Myhm.Util; +namespace LookingGlass.Util; public class RandomStringGenerator { diff --git a/Util/SwaggerTheme/CustomStyle.cs b/Util/SwaggerTheme/CustomStyle.cs index 110037d..11a9697 100644 --- a/Util/SwaggerTheme/CustomStyle.cs +++ b/Util/SwaggerTheme/CustomStyle.cs @@ -1,7 +1,6 @@ -using System; using AspNetCore.Swagger.Themes; -namespace Myhm.Util.SwaggerTheme; +namespace LookingGlass.Util.SwaggerTheme; public class CustomStyle : ModernStyle { diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index c09f7b0..8c8bf4a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,10 +1,10 @@ services: - myhm-commission-dev: - container_name: myhm-commission-dev + looking-glass-dev: + container_name: looking-glass-dev image: mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm@sha256:f84f5dc61134aacd099c03f58663994da48047a6f43b9d5ba446a5b5ad2074aa environment: CONFIGURATION__AUTHTOKEN: "hi" - CONFIGURATION__DATABASECONNECTIONSTRING: "postgres://myhm-commission:myhm-commission@postgres:5432/myhm-commission" + CONFIGURATION__DATABASECONNECTIONSTRING: "postgres://looking-glass:looking-glass@postgres:5432/looking-glass" ASPNETCORE_URLS: "http://0.0.0.0:8000" LOGGING__LOGLEVEL_DEFAULT: "Trace" CONFIGURATION__USESENTRY: false @@ -15,7 +15,7 @@ services: command: sleep infinity database: - container_name: myhm-commission-db + container_name: looking-glass-db extends: service: database file: ./docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index 846d668..0677a20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: - myhm-commission: - image: www.coastalcommits.com/cswimr/myhm-commission:latest + looking-glass: + image: www.coastalcommits.com/cswimr/lookingglass:latest ports: - 8000:8000 environment: @@ -20,7 +20,7 @@ services: # The only current valid value is `PostgresSQL`. This is used to determine which database type to use. CONFIGURATION__DATABASETYPE: "PostgresSQL" - CONFIGURATION__DATABASECONNECTIONSTRING: "postgres://myhm-commission:myhm-commission@postgres:5432/myhm-commission" + CONFIGURATION__DATABASECONNECTIONSTRING: "postgres://LookingGlass:LookingGlass@postgres:5432/LookingGlass" # Determines the log level for the application's default logger. # Valid values are `Trace`, `Debug`, `Information`, `Warning`, `Error`, and `Critical`. @@ -41,13 +41,13 @@ services: CONFIGURATION__USESWAGGER: true database: - container_name: myhm-commission-db + container_name: looking-glass-db image: postgres:17.2@sha256:87ec5e0a167dc7d4831729f9e1d2ee7b8597dcc49ccd9e43cc5f89e808d2adae restart: always environment: - POSTGRES_USER: myhm-commission - POSTGRES_PASSWORD: myhm-commission - POSTGRES_DB: myhm-commission + POSTGRES_USER: LookingGlass + POSTGRES_PASSWORD: LookingGlass + POSTGRES_DB: LookingGlass volumes: - postgres-data:/var/lib/postgresql/data