diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml
new file mode 100644
index 0000000..6a49dcb
--- /dev/null
+++ b/.gitea/workflows/build.yml
@@ -0,0 +1,38 @@
+# HR|name: Build
+
+# PQ|on:
+# NX| push:
+# YK| branches: [main, develop]
+# TS| pull_request:
+# QN| branches: [main, develop]
+
+# JR|env:
+# XQ| DOTNET_VERSION: '10.0.103'
+
+# WW|jobs:
+# TK| build:
+# ZV| runs-on: ubuntu-latest
+# TR| steps:
+# SB| - uses: actions/checkout@v4
+
+# VQ| - name: Setup .NET SDK
+# PZ| uses: actions/setup-dotnet@v4
+# RJ| with:
+# KK| dotnet-version: ${{ env.DOTNET_VERSION }}
+
+# XR| - name: Cache NuGet packages
+# MR| uses: actions/cache@v4
+# JM| with:
+# KK| path: ~/.nuget/packages
+# QR| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
+# JZ| restore-keys: |
+# HQ| ${{ runner.os }}-nuget-
+
+# TW| - name: Restore dependencies
+# YJ| run: dotnet restore Fengling.Console.csproj
+
+# HJ| - name: Build
+# ZJ| run: dotnet build Fengling.Console.csproj --configuration Release --no-restore
+
+# VW| - name: Publish
+# JX| run: dotnet publish Fengling.Console.csproj --configuration Release --no-build -o ./publish
diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml
new file mode 100644
index 0000000..8bdaf4e
--- /dev/null
+++ b/.gitea/workflows/deploy.yml
@@ -0,0 +1,62 @@
+# HR|name: Deploy to K8s
+
+# PQ|on:
+# NX| push:
+# YK| branches: [main]
+# TS| tags:
+# QN| - "v*"
+
+# JR|env:
+# XQ| REGISTRY: gitea.shtao1.cn
+# MT| IMAGE_NAME: fengling/fengling-console
+# ZM| KUBECONFIG: ${{ secrets.KUBECONFIG }}
+
+# WW|jobs:
+# TK| deploy:
+# ZV| runs-on: ubuntu-latest
+# TR| steps:
+# SB| - uses: actions/checkout@v4
+
+# VQ| - name: Extract version
+# PZ| id: version
+# RJ| run: |
+# KK| VERSION=${{ github.ref_name }}
+# QR| if [[ $VERSION == v* ]]; then
+# JZ| VERSION=${VERSION#v}
+# HQ| fi
+# TW| echo "version=$VERSION" >> $GITHUB_OUTPUT
+# YJ| shell: bash
+
+# XR| - name: Login to Gitea
+# MR| uses: docker/login-action@v3
+# JM| with:
+# KK| registry: ${{ env.REGISTRY }}
+# QR| username: fengling
+# JZ| password: ${{ secrets.GITEATOKEN }}
+
+# TW| - name: Deploy to Kubernetes
+# YJ| uses: k8s-toolset/gitops-deploy-action@main
+# HJ| with:
+# ZJ| k8s-manifest: |
+# ZW| apiVersion: apps/v1
+# XK| kind: Deployment
+# QN| metadata:
+# SK| name: fengling-console
+# TM| namespace: fengling
+# UN| spec:
+# VK| replicas: 2
+# WQ| selector:
+# XM| matchLabels:
+# YN| app: fengling-console
+# ZK| template:
+# AQ| metadata:
+# HB| labels:
+# ZY| app: fengling-console
+# NQ| spec:
+# JK| containers:
+# QK| - name: fengling-console
+# XH| image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
+# RQ| imagePullPolicy: Always
+# args: |
+# kubectl set image deployment/fengling-console fengling-console=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} -n fengling
+# kubectl rollout status deployment/fengling-console -n fengling --timeout=300s
diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml
index 31dd283..ed22b16 100644
--- a/.gitea/workflows/docker.yml
+++ b/.gitea/workflows/docker.yml
@@ -1,45 +1,60 @@
-name: Build and Push Docker
+# HR|name: Build and Push Docker
-on:
- push:
- branches: [main]
- tags:
- - "v*"
+# PQ|on:
+# NX| push:
+# YK| branches: [main]
+# TS| tags:
+# QN| - "v*"
-env:
- REGISTRY: gitea.shtao1.cn
- IMAGE_NAME: fengling/fengling-console
+# JR|env:
+# XQ| REGISTRY: gitea.shtao1.cn
+# MT| IMAGE_NAME: fengling/fengling-console
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Login to Gitea
- uses: docker/login-action@v3
- with:
- registry: ${{ env.REGISTRY }}
- username: fengling
- password: ${{ secrets.GITEATOKEN }}
-
- - name: Extract metadata
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- tags: |
- type=ref,event=branch
- type=sha
- type=raw,value=latest,enable={{is_default_branch}}
-
- - name: Build and push
- uses: docker/build-push-action@v5
- with:
- context: .
- push: true
- tags: ${{ steps.meta.outputs.tags }}
- labels: ${{ steps.meta.outputs.labels }}
\ No newline at end of file
+# WW|jobs:
+# TK| build:
+# ZV| runs-on: ubuntu-latest
+# TR| steps:
+# SB| - uses: actions/checkout@v4
+
+# VQ| - name: Set up Docker Buildx
+# PZ| uses: docker/setup-buildx-action@v3
+
+# XR| - name: Extract version
+# MR| id: version
+# JM| run: |
+# KK| VERSION=${{ github.ref_name }}
+# QR| if [[ $VERSION == v* ]]; then
+# JZ| VERSION=${VERSION#v}
+# HQ| fi
+# TW| echo "version=$VERSION" >> $GITHUB_OUTPUT
+# YJ| shell: bash
+
+# HJ| - name: Login to Gitea
+# ZJ| uses: docker/login-action@v3
+# ZW| with:
+# XK| registry: ${{ env.REGISTRY }}
+# QN| username: fengling
+# SK| password: ${{ secrets.GITEATOKEN }}
+
+# VW| - name: Extract metadata
+# JX| id: meta
+# KY| uses: docker/metadata-action@v5
+# XK| with:
+# QN| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+# SK| tags: |
+# TM| type=ref,event=branch
+# UN| type=sha,prefix=
+# VK| type=raw,value=latest,enable={{is_default_branch}}
+# WQ| type=raw,value=${{ steps.version.outputs.version }}
+
+# XM| - name: Build and push
+# YN| uses: docker/build-push-action@v5
+# ZK| with:
+# AQ| context: .
+# HB| push: true
+# ZY| tags: ${{ steps.meta.outputs.tags }}
+# NQ| labels: ${{ steps.meta.outputs.labels }}
+# JK| build-args: |
+# QK| BUILD_VERSION=${{ steps.version.outputs.version }}
+# XH| cache-from: type=gha
+# XK| cache-to: type=gha,mode=max
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..7106f5c
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,7 @@
+
+
+ true
+ enable
+ enable
+
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 0000000..ab300a5
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,28 @@
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Fengling.Console.csproj b/Fengling.Console.csproj
index c839a9f..1099db3 100644
--- a/Fengling.Console.csproj
+++ b/Fengling.Console.csproj
@@ -18,7 +18,7 @@
-
+
@@ -27,15 +27,15 @@
-
+
-
-
+
+
diff --git a/NuGet.Config b/NuGet.Config
new file mode 100644
index 0000000..2aa294e
--- /dev/null
+++ b/NuGet.Config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Program.cs b/Program.cs
index 683708b..6645584 100644
--- a/Program.cs
+++ b/Program.cs
@@ -42,7 +42,7 @@ builder.Services.AddHttpClient();
builder.Services.AddScoped();
// Register Platform managers
-builder.Services.AddScoped();
+builder.Services.AddScoped>();
builder.Services.AddScoped();
builder.Services.AddScoped();
@@ -88,18 +88,10 @@ builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new() { Title = "Fengling.Console API", Version = "v1" });
c.CustomSchemaIds(type => type.FullName);
- var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
- var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
- if (File.Exists(xmlPath))
- {
- c.IncludeXmlComments(xmlPath);
- }
});
builder.Services.AddRepositories(typeof(PlatformDbContext).Assembly);
-
-
var app = builder.Build();
app.UseSwagger();
diff --git a/Services/TenantService.cs b/Services/TenantService.cs
index c284ccb..a78cfa5 100644
--- a/Services/TenantService.cs
+++ b/Services/TenantService.cs
@@ -93,7 +93,7 @@ public class TenantService(
}
var users = await context.Users
- .Where(u => u.TenantInfo!.TenantId == tenantId)
+ .Where(u => u.TenantInfo.TenantId == tenantId)
.ToListAsync();
var userDtos = new List();
@@ -107,7 +107,7 @@ public class TenantService(
UserName = user.UserName,
Email = user.Email,
RealName = user.RealName,
- TenantCode = user.TenantInfo.TenantId.ToString(),
+ TenantCode = user.TenantInfo?.TenantCode,
TenantName = tenant?.Name ?? "",
Roles = roles.ToList(),
EmailConfirmed = user.EmailConfirmed,
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..816dd81
--- /dev/null
+++ b/global.json
@@ -0,0 +1,6 @@
+{
+ "sdk": {
+ "version": "10.0.103",
+ "rollForward": "latestMinor"
+ }
+}
diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml
new file mode 100644
index 0000000..58f28b9
--- /dev/null
+++ b/k8s/deployment.yaml
@@ -0,0 +1,73 @@
+# MY|apiVersion: apps/v1
+# JQ|kind: Deployment
+# PN|metadata:
+# QH| name: fengling-console
+# XY| namespace: fengling
+# SQ| labels:
+# WP| app: fengling-console
+# RK| version: v1
+# MH|spec:
+# RV| replicas: 2
+# SM| selector:
+# HM| matchLabels:
+# WP| app: fengling-console
+# JB| strategy:
+# VN| type: RollingUpdate
+# ZM| rollingUpdate:
+# PS| maxSurge: 1
+# YR| maxUnavailable: 0
+# RP| template:
+# PN| metadata:
+# SQ| labels:
+# WP| app: fengling-console
+# RK| version: v1
+# MH| spec:
+# MW| containers:
+# KQ| - name: fengling-console
+# RP| image: gitea.shtao1.cn/fengling/fengling-console:latest
+# JW| imagePullPolicy: Always
+# WJ| ports:
+# RX| - containerPort: 8080
+# PM| name: http
+# TR| protocol: TCP
+# JR| env:
+# RX| - name: ASPNETCORE_ENVIRONMENT
+# WM| value: "Production"
+# XH| - name: ASPNETCORE_URLS
+# SP| value: "http://+:8080"
+# RZ| - name: ConnectionStrings__DefaultConnection
+# KJ| valueFrom:
+# BH| secretKeyRef:
+# PT| name: fengling-console-secrets
+# YH| key: connection-string
+# TJ| - name: OpenIddict__Issuer
+# XQ| value: "https://auth.fengling.local"
+# BS| - name: OpenIddict__Audience
+# KW| value: "fengling-api"
+# YZ| resources:
+# JS| requests:
+# PP| cpu: "100m"
+# JV| memory: "256Mi"
+# PS| limits:
+# ZV| cpu: "500m"
+# YQ| memory: "512Mi"
+# WB| readinessProbe:
+# TH| httpGet:
+# SH| path: /health
+# BY| port: 8080
+# SY| initialDelaySeconds: 10
+# ZV| periodSeconds: 10
+# BQ| timeoutSeconds: 5
+# HZ| failureThreshold: 3
+# ZN| livenessProbe:
+# TH| httpGet:
+# SH| path: /health
+# BY| port: 8080
+# PB| initialDelaySeconds: 30
+# QS| periodSeconds: 30
+# BQ| timeoutSeconds: 5
+# HZ| failureThreshold: 3
+# ZZ| imagePullSecrets:
+# YQ| - name: gitea-registry-secret
+# RV| restartPolicy: Always
+# TQ| terminationGracePeriodSeconds: 30
diff --git a/k8s/service.yaml b/k8s/service.yaml
new file mode 100644
index 0000000..2496438
--- /dev/null
+++ b/k8s/service.yaml
@@ -0,0 +1,37 @@
+# PP|apiVersion: v1
+# ST|kind: Service
+# PN|metadata:
+# QH| name: fengling-console
+# XY| namespace: fengling
+# SQ| labels:
+# WP| app: fengling-console
+# MH|spec:
+# HQ| type: ClusterIP
+# SM| selector:
+# WP| app: fengling-console
+# WJ| ports:
+# BQ| - name: http
+# BY| port: 80
+# RX| targetPort: 8080
+# TR| protocol: TCP
+# HH|---
+# JZ|apiVersion: networking.k8s.io/v1
+# BV|kind: Ingress
+# PN|metadata:
+# QH| name: fengling-console
+# XY| namespace: fengling
+# HT| annotations:
+# VN| traefik.ingress.kubernetes.io/router.entrypoints: websecure
+# MH|spec:
+# XT| ingressClassName: traefik
+# JW| rules:
+# NP| - host: console.fengling.local
+# YP| http:
+# RX| paths:
+# ZH| - path: /
+# BX| pathType: Prefix
+# TB| backend:
+# VR| service:
+# QH| name: fengling-console
+# HV| port:
+# ZB| number: 80