From ac9d0aa15051234a5d285d3c7da2a93a7900e182 Mon Sep 17 00:00:00 2001 From: Quang nd Date: Thu, 24 Oct 2024 16:18:30 +0700 Subject: [PATCH] fix --- .azdo/pipelines/azure-dev.yml | 57 ----------------------------- .devcontainer/devcontainer.json | 31 ---------------- .github/FUNDING.yml | 13 ------- .github/workflows/azure-dev.yml | 64 --------------------------------- Directory.Build.props | 3 +- UserService.sln | 20 +++++------ azure.yaml | 9 ----- src/Api/Program.cs | 12 +++---- src/Api/appsettings.json | 10 ++++-- 9 files changed, 22 insertions(+), 197 deletions(-) delete mode 100644 .azdo/pipelines/azure-dev.yml delete mode 100644 .devcontainer/devcontainer.json delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/workflows/azure-dev.yml delete mode 100644 azure.yaml diff --git a/.azdo/pipelines/azure-dev.yml b/.azdo/pipelines/azure-dev.yml deleted file mode 100644 index 8c67ec0..0000000 --- a/.azdo/pipelines/azure-dev.yml +++ /dev/null @@ -1,57 +0,0 @@ -# Run when commits are pushed to mainline branch (main or master) -# Set this to the mainline branch you are using -trigger: - - main - - master - -# Azure Pipelines workflow to deploy to Azure using azd -# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo` -# Task "Install azd" needs to install setup-azd extension for azdo - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd -# See below for alternative task to install azd if you can't install above task in your organization - -pool: - vmImage: ubuntu-latest - -steps: - - task: setup-azd@0 - displayName: Install azd - - # If you can't install above task in your organization, you can comment it and uncomment below task to install azd - # - task: Bash@3 - # displayName: Install azd - # inputs: - # targetType: 'inline' - # script: | - # curl -fsSL https://aka.ms/install-azd.sh | bash - - # azd delegate auth to az to use service connection with AzureCLI@2 - - pwsh: | - azd config set auth.useAzCliAuth "true" - displayName: Configure AZD to Use AZ CLI Authentication. - - - task: AzureCLI@2 - displayName: Provision Infrastructure - inputs: - azureSubscription: azconnection - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - azd provision --no-prompt - env: - AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID) - AZURE_ENV_NAME: $(AZURE_ENV_NAME) - AZURE_LOCATION: $(AZURE_LOCATION) - AZD_INITIAL_ENVIRONMENT_CONFIG: $(secrets.AZD_INITIAL_ENVIRONMENT_CONFIG) - - - task: AzureCLI@2 - displayName: Deploy Application - inputs: - azureSubscription: azconnection - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - azd deploy --no-prompt - env: - AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID) - AZURE_ENV_NAME: $(AZURE_ENV_NAME) - AZURE_LOCATION: $(AZURE_LOCATION) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 575f26e..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "Azure Developer CLI", - "image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye", - "features": { - // See https://containers.dev/features for list of features - "ghcr.io/devcontainers/features/docker-in-docker:2": { - }, - "ghcr.io/azure/azure-dev/azd:latest": {} - }, - "customizations": { - "vscode": { - "extensions": [ - "GitHub.vscode-github-actions", - "ms-azuretools.azure-dev", - "ms-azuretools.vscode-azurefunctions", - "ms-azuretools.vscode-bicep", - "ms-azuretools.vscode-docker" - // Include other VSCode language extensions if needed - // Right click on an extension inside VSCode to add directly to devcontainer.json, or copy the extension ID - ] - } - }, - "forwardPorts": [ - // Forward ports if needed for local development - ], - "postCreateCommand": "", - "remoteUser": "vscode", - "hostRequirements": { - "memory": "8gb" - } -} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 27f72a1..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,13 +0,0 @@ -# These are supported funding model platforms - -github: JasonTaylorDev # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -# patreon: # Replace with a single Patreon username -# open_collective: # Replace with a single Open Collective username -# ko_fi: # Replace with a single Ko-fi username -# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -# liberapay: # Replace with a single Liberapay username -# issuehunt: # Replace with a single IssueHunt username -# otechie: # Replace with a single Otechie username -# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml deleted file mode 100644 index 7b374fa..0000000 --- a/.github/workflows/azure-dev.yml +++ /dev/null @@ -1,64 +0,0 @@ -on: - workflow_dispatch: - push: - # Run when commits are pushed to mainline branch (main or master) - # Set this to the mainline branch you are using - branches: - - main - - master - -# GitHub Actions workflow to deploy to Azure using azd -# To configure required secrets for connecting to Azure, simply run `azd pipeline config` - -# Set up permissions for deploying with secretless Azure federated credentials -# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication -permissions: - id-token: write - contents: read - -jobs: - build: - runs-on: ubuntu-latest - env: - AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} - AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} - AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install azd - uses: Azure/setup-azd@v1.0.0 - - - name: Log in with Azure (Federated Credentials) - if: ${{ env.AZURE_CLIENT_ID != '' }} - run: | - azd auth login ` - --client-id "$Env:AZURE_CLIENT_ID" ` - --federated-credential-provider "github" ` - --tenant-id "$Env:AZURE_TENANT_ID" - shell: pwsh - - - name: Log in with Azure (Client Credentials) - if: ${{ env.AZURE_CREDENTIALS != '' }} - run: | - $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable; - Write-Host "::add-mask::$($info.clientSecret)" - - azd auth login ` - --client-id "$($info.clientId)" ` - --client-secret "$($info.clientSecret)" ` - --tenant-id "$($info.tenantId)" - shell: pwsh - env: - AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Provision Infrastructure - run: azd provision --no-prompt - env: - AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} - - - name: Deploy Application - run: azd deploy --no-prompt diff --git a/Directory.Build.props b/Directory.Build.props index 9ee73ed..5b7fc9a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,9 +2,8 @@ net8.0 + enable true - enable - enable \ No newline at end of file diff --git a/UserService.sln b/UserService.sln index 93fe751..6e2882a 100644 --- a/UserService.sln +++ b/UserService.sln @@ -3,6 +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 + # src Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "src\Domain\Domain.csproj", "{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}" EndProject @@ -27,9 +28,6 @@ EndProject #Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{664D406C-2F83-48F0-BFC3-408D5CB53C65}" #EndProject - - - Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -57,14 +55,14 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C7E89A3E-A631-4760-8D61-BD1EAB1C4E69} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} - {34C0FACD-F3D9-400C-8945-554DD6B0819A} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} - {117DA02F-5274-4565-ACC6-DA9B6E568B09} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} - {4E4EE20C-F06A-4A1B-851F-C5577796941C} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} - {DEFF4009-1FAB-4392-80B6-707E2DC5C00B} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} - {DC37FD87-552C-4613-9F16-1537CA522898} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} - {EA6127A5-94C9-4C31-AD11-E6811B92B520} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} - {01FA6786-921D-4CE8-8C50-4FDA66C9477D} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} +# {C7E89A3E-A631-4760-8D61-BD1EAB1C4E69} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} +# {34C0FACD-F3D9-400C-8945-554DD6B0819A} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} +# {117DA02F-5274-4565-ACC6-DA9B6E568B09} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} +# {4E4EE20C-F06A-4A1B-851F-C5577796941C} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} +# {DEFF4009-1FAB-4392-80B6-707E2DC5C00B} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} +# {DC37FD87-552C-4613-9F16-1537CA522898} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} +# {EA6127A5-94C9-4C31-AD11-E6811B92B520} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} +# {01FA6786-921D-4CE8-8C50-4FDA66C9477D} = {664D406C-2F83-48F0-BFC3-408D5CB53C65} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3CB609D9-5D54-4C11-A371-DAAC8B74E430} diff --git a/azure.yaml b/azure.yaml deleted file mode 100644 index 2df2a2c..0000000 --- a/azure.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json - -# Name of the application. -name: clean-architecture-azd -services: - web: - language: csharp - project: ./src/Web - host: appservice diff --git a/src/Api/Program.cs b/src/Api/Program.cs index ef32500..188d725 100644 --- a/src/Api/Program.cs +++ b/src/Api/Program.cs @@ -1,11 +1,11 @@ +using UserService.Application; using UserService.Infrastructure; -using UserService.Infrastructure.Data; using UserService.Api.Services.ConsulConfiguration; -using UserService.Application; -using UserService.Domain.Entities; -WebApplicationBuilder builder = WebApplication.CreateBuilder(args); +var builder = WebApplication.CreateBuilder(args); +var options = new WebApplicationOptions(); +var builder1 = WebApplication.CreateEmptyBuilder(options); // builder.Configuration // .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) // .AddEnvironmentVariables() @@ -49,7 +49,3 @@ app.MapEndpoints(); app.Run(); - -public abstract partial class Program -{ -} diff --git a/src/Api/appsettings.json b/src/Api/appsettings.json index cab42a1..6046de3 100644 --- a/src/Api/appsettings.json +++ b/src/Api/appsettings.json @@ -1,8 +1,14 @@ { "AllowedHosts": "*", - "ConsulAddress": "http://localhost:8500/", + "ExternalConfiguration": { + "Consul": { + "Url": "http://localhost:8500/", + "key": "" + } + }, "ConnectionStrings": { - "MSSqlServer": "Server=(localdb)\\mssqllocaldb;Database=UserServiceDb;Trusted_Connection=True;MultipleActiveResultSets=true" + "MSSqlServer": "Server=(localdb)\\mssqllocaldb;Database=UserServiceDb;Trusted_Connection=True;MultipleActiveResultSets=true", + "MongoDb": "" }, "Logging": { "LogLevel": {