convert to template
All checks were successful
Template Cleanup / Template Cleanup (push) Has been skipped

This commit is contained in:
Liam Chan 2024-09-04 11:36:03 +08:00
parent 3085195290
commit 8b7e7a3f85
13 changed files with 31 additions and 34 deletions

View File

@ -5,11 +5,11 @@ on:
jobs:
# 当前仓库名不为 zabbix-agent-2-plugin-template 时触发
# 当前仓库名不为 zabbix-agent2-plugin-template 时触发
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
#if: github.event.repository.name != 'zabbix-agent-2-plugin-template'
if: github.event.repository.name != 'zabbix-agent2-plugin-template'
permissions:
contents: write
steps:
@ -24,18 +24,15 @@ jobs:
export LC_CTYPE=C
export LANG=C
# 变量
# 准备变量
OWNER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
REPO_NAME="${GITHUB_REPOSITORY##*/}"
SAFE_OWNER=$(echo $OWNER | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
SAFE_REPO_NAME=$(echo $REPO_NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
GROUP="cn.sh.ittc.$SAFE_OWNER.$SAFE_REPO_NAME"
echo $REPO_NAME
echo $OWNER
echo $SAFE_REPO_NAME
echo $SAFE_OWNER
echo $GROUP
# 替换模板包名
find src -type f -exec sed -i "s/zabbixagent2plugintemplate/$SAFE_REPO_NAME/g" {} +
find src -type f -exec sed -i "s/Zabbix Agent 2 Plugin Template/$REPO_NAME/g" {} +
# # 记录文件修改
# - name: Commit files

View File

@ -6,8 +6,8 @@ services:
ZBX_SERVER_HOST: server
ZBX_SERVER_PORT: 10051
volumes:
- ./log:/var/log/onvif-agent
- ./config.yaml:/etc/onvif-agent/config.yaml
- ./log:/var/log/zabbixagent2plugintemplate
- ./config.yaml:/etc/zabbixagent2plugintemplate/config.yaml
ports:
- "8080:8080"
networks:

View File

@ -4,8 +4,8 @@ import (
"fmt"
"github.com/spf13/viper"
"log"
"onvif-agent/constant"
"os"
"zabbixagent2plugintemplate/constant"
)
type config struct {

View File

@ -1,6 +1,6 @@
package constant
const (
AppName = "onvif-agent"
AppName = "zabbixagent2plugintemplate"
AppVersion = "1.0.0"
)

2
go.mod
View File

@ -1,4 +1,4 @@
module onvif-agent
module zabbixagent2plugintemplate
go 1.23.0

View File

@ -3,9 +3,9 @@ package zabbixagent
import (
"fmt"
"github.com/gin-gonic/gin"
"onvif-agent/response"
handler "onvif-agent/router/handler/onvif"
service "onvif-agent/service/onvif"
"zabbixagent2plugintemplate/response"
handler "zabbixagent2plugintemplate/router/handler/onvif"
service "zabbixagent2plugintemplate/service/onvif"
)
func DiscoverONVIFDevices(c *gin.Context) {

View File

@ -6,9 +6,9 @@ import (
"golang.zabbix.com/sdk/errs"
"io"
"net/http"
"onvif-agent/config"
"onvif-agent/constant"
"strings"
"zabbixagent2plugintemplate/config"
"zabbixagent2plugintemplate/constant"
)
// HandlerFunc describes the signature all metric handler functions must have.

View File

@ -5,14 +5,14 @@ import (
"github.com/gin-gonic/gin"
"io"
"log"
"onvif-agent/config"
"onvif-agent/constant"
"onvif-agent/integration/zabbixagent"
"onvif-agent/router"
"os"
"path/filepath"
"runtime"
"time"
"zabbixagent2plugintemplate/config"
"zabbixagent2plugintemplate/constant"
"zabbixagent2plugintemplate/integration/zabbixagent"
"zabbixagent2plugintemplate/router"
)
func main() {

View File

@ -2,7 +2,7 @@ package handler
import (
"github.com/gin-gonic/gin"
"onvif-agent/response"
"zabbixagent2plugintemplate/response"
)
func Hello(c *gin.Context) {

View File

@ -2,8 +2,8 @@ package onvif
import (
"github.com/gin-gonic/gin"
"onvif-agent/response"
"onvif-agent/service/onvif"
"zabbixagent2plugintemplate/response"
"zabbixagent2plugintemplate/service/onvif"
)
func GetNotifications(c *gin.Context) {

View File

@ -3,8 +3,8 @@ package onvif
import (
"github.com/gin-gonic/gin"
"net/http"
"onvif-agent/response"
"onvif-agent/service/onvif"
"zabbixagent2plugintemplate/response"
"zabbixagent2plugintemplate/service/onvif"
)
type CreateSessionRequest struct {

View File

@ -7,9 +7,9 @@ import (
"github.com/gin-gonic/gin"
"log"
"net/http"
"onvif-agent/config"
"onvif-agent/response"
"onvif-agent/service/onvif"
"zabbixagent2plugintemplate/config"
"zabbixagent2plugintemplate/response"
"zabbixagent2plugintemplate/service/onvif"
)
func CreateSubscription(c *gin.Context) {

View File

@ -2,9 +2,9 @@ package router
import (
"github.com/gin-gonic/gin"
"onvif-agent/integration/zabbixagent"
"onvif-agent/router/handler"
"onvif-agent/router/handler/onvif"
"zabbixagent2plugintemplate/integration/zabbixagent"
"zabbixagent2plugintemplate/router/handler"
"zabbixagent2plugintemplate/router/handler/onvif"
)
func SetupRoutes(r *gin.Engine) {