webhook

command module
v0.0.0-...-3241eb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

README

Webhook

Webhook hosted by golang

Download

git clone https://github.com/LucienShui/Webhook.git -b build --depth=1

Usage

Usage of webhook:
  -c string
        -c <config file> (default "./config.json")
  -version
        Print version information

Config

For example, config.json looks like below:

{
  "address": "0.0.0.0",
  "port": 10086,
  "webhooks": [
    {
      "name": "beat",
      "script": "echo 'It works!'",
      "password": ""
    },
    {
      "name": "hello",
      "script": "set -x && echo 'Hello World!'",
      "password": "world"
    }
  ]
}

One can access the API /:name?password= to execute the script

API

Execute

POST /:name?password=[password]

Params
Name Type Description
name string record's name
password string record's password
Example
curl -X POST <host>:[port]/hello?password=word
Log

GET /log/:name?raw=true

Params
Name Type Description
name string record's name
raw bool show execute's output in raw or not, false for default
Example
curl <host>:[port]/log/hello?raw=true
curl <host>:[port]/log/hello

Documentation

Overview

@File: main.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien

@Modify Time @Author @Version @Description ------------ ------- -------- ----------- 2019-07-24 23:14 Lucien 1.0 Init

Directories

Path Synopsis
@File: flag.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien
@File: flag.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien
@File: config.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien Shui
@File: config.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien Shui
@File: handler.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien
@File: handler.go @Contact: lucien@lucien.ink @Licence: (C)Copyright 2019 Lucien

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL