Add configuration and other related code, and add automatic build related frameworks. Currently, the version is not available

This commit is contained in:
2025-11-22 16:04:45 +08:00
parent 849cfcd9d7
commit 2a3ef3e52a
5 changed files with 65 additions and 16 deletions

34
.github/workflows/test-and-build.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Test and Build Project
on:
workflow_dispatch:
inputs:
build_type:
description: "Build type: version or pre"
required: true
type: choice
options:
- version
- pre
version_number:
description: "Version number"
required: true
type: string
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Test code
run: |
echo "Testing code"
- name: Build version
if: ${{ github.event.inputs.build_type == 'version' }}
run: |
echo "Building version ${{ github.event.inputs.version_number }}"
go mod tidy
- name: Build pre-release
if: ${{ github.event.inputs.build_type == 'pre' }}
run: |
echo "Building pre-release ${{ github.event.inputs.version_number }}"
go mod tidy

View File

@@ -1,16 +0,0 @@
name: Test Runners
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-runners:
runs-on: self-hosted
steps:
- name: test-runners
run: |
echo "Testing runners..."
cat /etc/os-release

14
config.example.json Normal file
View File

@@ -0,0 +1,14 @@
{
"server": {
"host": "0.0.0.0",
"port": 2233
},
"database": {
"host": "localhost",
"port": 3306,
"username": "root",
"password": "password",
"database": "meowbox",
"prefix": "box_"
}
}

View File

View File

@@ -0,0 +1,17 @@
package service
// Config represents the full configuration structure
type Config struct {
Server struct {
Host string `json:"host"`
Port int `json:"port"`
} `json:"server"`
Database struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
Database string `json:"database"`
Prefix string `json:"prefix"`
} `json:"database"`
}