This commit is contained in:
parent
fdd4cf73c3
commit
9b98e76046
19
.gitea/workflows/demo.yaml
Normal file
19
.gitea/workflows/demo.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: runner
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
@ -2,8 +2,8 @@ package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/query"
|
||||
"github.com/redis/go-redis/v9"
|
||||
@ -24,11 +24,10 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
||||
//初始化redis client
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: c.RedisHost,
|
||||
Addr: c.Redis[0].Host,
|
||||
})
|
||||
//初始化数据库
|
||||
//todo
|
||||
db, err := my_gorm.NewDBWithCache(mysql.Open(c.Mysql.Dsn), &gorm.Config{}, redisClient)
|
||||
db, err := my_gorm.NewDBWithCache(mysql.Open(c.Mysql), &gorm.Config{}, redisClient)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -1,27 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/server"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/ranking_management.yaml", "the config file")
|
||||
const ServiceName = "ranking_management"
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
err := config.GetConfig(&c, ServiceName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.RpcServerConf.Name = ServiceName + ".rpc"
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
@ -33,6 +36,6 @@ func main() {
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user