convert to template
All checks were successful
Template Cleanup / Template Cleanup (push) Has been skipped
All checks were successful
Template Cleanup / Template Cleanup (push) Has been skipped
This commit is contained in:
parent
3085195290
commit
8b7e7a3f85
@ -5,11 +5,11 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# 当前仓库名不为 zabbix-agent-2-plugin-template 时触发
|
# 当前仓库名不为 zabbix-agent2-plugin-template 时触发
|
||||||
template-cleanup:
|
template-cleanup:
|
||||||
name: Template Cleanup
|
name: Template Cleanup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
#if: github.event.repository.name != 'zabbix-agent-2-plugin-template'
|
if: github.event.repository.name != 'zabbix-agent2-plugin-template'
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
@ -24,18 +24,15 @@ jobs:
|
|||||||
export LC_CTYPE=C
|
export LC_CTYPE=C
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
# 变量
|
# 准备变量
|
||||||
OWNER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
|
OWNER=$(echo $GITHUB_REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
|
||||||
REPO_NAME="${GITHUB_REPOSITORY##*/}"
|
REPO_NAME="${GITHUB_REPOSITORY##*/}"
|
||||||
SAFE_OWNER=$(echo $OWNER | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
|
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:]')
|
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
|
find src -type f -exec sed -i "s/zabbixagent2plugintemplate/$SAFE_REPO_NAME/g" {} +
|
||||||
echo $SAFE_REPO_NAME
|
find src -type f -exec sed -i "s/Zabbix Agent 2 Plugin Template/$REPO_NAME/g" {} +
|
||||||
echo $SAFE_OWNER
|
|
||||||
echo $GROUP
|
|
||||||
|
|
||||||
# # 记录文件修改
|
# # 记录文件修改
|
||||||
# - name: Commit files
|
# - name: Commit files
|
||||||
|
@ -6,8 +6,8 @@ services:
|
|||||||
ZBX_SERVER_HOST: server
|
ZBX_SERVER_HOST: server
|
||||||
ZBX_SERVER_PORT: 10051
|
ZBX_SERVER_PORT: 10051
|
||||||
volumes:
|
volumes:
|
||||||
- ./log:/var/log/onvif-agent
|
- ./log:/var/log/zabbixagent2plugintemplate
|
||||||
- ./config.yaml:/etc/onvif-agent/config.yaml
|
- ./config.yaml:/etc/zabbixagent2plugintemplate/config.yaml
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
networks:
|
networks:
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"log"
|
"log"
|
||||||
"onvif-agent/constant"
|
|
||||||
"os"
|
"os"
|
||||||
|
"zabbixagent2plugintemplate/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package constant
|
package constant
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AppName = "onvif-agent"
|
AppName = "zabbixagent2plugintemplate"
|
||||||
AppVersion = "1.0.0"
|
AppVersion = "1.0.0"
|
||||||
)
|
)
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module onvif-agent
|
module zabbixagent2plugintemplate
|
||||||
|
|
||||||
go 1.23.0
|
go 1.23.0
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package zabbixagent
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"onvif-agent/response"
|
"zabbixagent2plugintemplate/response"
|
||||||
handler "onvif-agent/router/handler/onvif"
|
handler "zabbixagent2plugintemplate/router/handler/onvif"
|
||||||
service "onvif-agent/service/onvif"
|
service "zabbixagent2plugintemplate/service/onvif"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DiscoverONVIFDevices(c *gin.Context) {
|
func DiscoverONVIFDevices(c *gin.Context) {
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"golang.zabbix.com/sdk/errs"
|
"golang.zabbix.com/sdk/errs"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"onvif-agent/config"
|
|
||||||
"onvif-agent/constant"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"zabbixagent2plugintemplate/config"
|
||||||
|
"zabbixagent2plugintemplate/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandlerFunc describes the signature all metric handler functions must have.
|
// HandlerFunc describes the signature all metric handler functions must have.
|
||||||
|
8
main.go
8
main.go
@ -5,14 +5,14 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"onvif-agent/config"
|
|
||||||
"onvif-agent/constant"
|
|
||||||
"onvif-agent/integration/zabbixagent"
|
|
||||||
"onvif-agent/router"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
"zabbixagent2plugintemplate/config"
|
||||||
|
"zabbixagent2plugintemplate/constant"
|
||||||
|
"zabbixagent2plugintemplate/integration/zabbixagent"
|
||||||
|
"zabbixagent2plugintemplate/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -2,7 +2,7 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"onvif-agent/response"
|
"zabbixagent2plugintemplate/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Hello(c *gin.Context) {
|
func Hello(c *gin.Context) {
|
||||||
|
@ -2,8 +2,8 @@ package onvif
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"onvif-agent/response"
|
"zabbixagent2plugintemplate/response"
|
||||||
"onvif-agent/service/onvif"
|
"zabbixagent2plugintemplate/service/onvif"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetNotifications(c *gin.Context) {
|
func GetNotifications(c *gin.Context) {
|
||||||
|
@ -3,8 +3,8 @@ package onvif
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"onvif-agent/response"
|
"zabbixagent2plugintemplate/response"
|
||||||
"onvif-agent/service/onvif"
|
"zabbixagent2plugintemplate/service/onvif"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateSessionRequest struct {
|
type CreateSessionRequest struct {
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"onvif-agent/config"
|
"zabbixagent2plugintemplate/config"
|
||||||
"onvif-agent/response"
|
"zabbixagent2plugintemplate/response"
|
||||||
"onvif-agent/service/onvif"
|
"zabbixagent2plugintemplate/service/onvif"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateSubscription(c *gin.Context) {
|
func CreateSubscription(c *gin.Context) {
|
||||||
|
@ -2,9 +2,9 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"onvif-agent/integration/zabbixagent"
|
"zabbixagent2plugintemplate/integration/zabbixagent"
|
||||||
"onvif-agent/router/handler"
|
"zabbixagent2plugintemplate/router/handler"
|
||||||
"onvif-agent/router/handler/onvif"
|
"zabbixagent2plugintemplate/router/handler/onvif"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetupRoutes(r *gin.Engine) {
|
func SetupRoutes(r *gin.Engine) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user