Compare commits
10 Commits
2113e8eade
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f297fd935 | |||
| eee5cb2fef | |||
| 6d5c7141fb | |||
| cf08c9e928 | |||
| 2a8cb0bb54 | |||
| 3e4ae9cf27 | |||
| 57e35bc202 | |||
| cb01f7554a | |||
| 12869d1ec0 | |||
| 0341c7c6b3 |
@@ -13,6 +13,7 @@ builds:
|
|||||||
- 386
|
- 386
|
||||||
- arm64
|
- arm64
|
||||||
- arm
|
- arm
|
||||||
|
- riscv64
|
||||||
archives:
|
archives:
|
||||||
- id: archive
|
- id: archive
|
||||||
name_template: "{{ .ProjectName }}-{{ .Arch }}"
|
name_template: "{{ .ProjectName }}-{{ .Arch }}"
|
||||||
|
|||||||
@@ -17,5 +17,4 @@ pipeline:
|
|||||||
- PLUGIN_WATCH_DEPLOYMENT=true
|
- PLUGIN_WATCH_DEPLOYMENT=true
|
||||||
- PLUGIN_WATCH_DEPLOYMENT_TIMEOUT=10m
|
- PLUGIN_WATCH_DEPLOYMENT_TIMEOUT=10m
|
||||||
when:
|
when:
|
||||||
branch: public
|
event: tag
|
||||||
event: push
|
|
||||||
@@ -41,6 +41,7 @@ var (
|
|||||||
ErrInvalidHdrVal = errors.New("invalid header value type")
|
ErrInvalidHdrVal = errors.New("invalid header value type")
|
||||||
ErrInvalidType = errors.New("invalid type")
|
ErrInvalidType = errors.New("invalid type")
|
||||||
ErrInsecureWebhook = errors.New("secure webhook missing authorization")
|
ErrInsecureWebhook = errors.New("secure webhook missing authorization")
|
||||||
|
ErrIncorrectPassword = errors.New("incorrect password")
|
||||||
)
|
)
|
||||||
|
|
||||||
var httpModule = &starlarkstruct.Module{
|
var httpModule = &starlarkstruct.Module{
|
||||||
@@ -352,10 +353,8 @@ func verifySecure(pwdHash, pluginName string, req *http.Request) error {
|
|||||||
return ErrInsecureWebhook
|
return ErrInsecureWebhook
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(pwd))
|
|
||||||
|
|
||||||
if err := bcrypt.CompareHashAndPassword([]byte(pwdHash), pwd); err != nil {
|
if err := bcrypt.CompareHashAndPassword([]byte(pwdHash), pwd); err != nil {
|
||||||
return err
|
return ErrIncorrectPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
10
main.go
10
main.go
@@ -41,7 +41,6 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.Logger = logger.NewPretty(os.Stderr)
|
log.Logger = logger.NewPretty(os.Stderr)
|
||||||
log.Logger.SetLevel(logger.LogLevelDebug)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -51,8 +50,13 @@ func main() {
|
|||||||
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
|
serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address")
|
||||||
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
|
genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks")
|
||||||
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
|
useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration")
|
||||||
|
debug := pflag.BoolP("debug", "D", false, "Enable debug logging")
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
|
|
||||||
|
if *debug {
|
||||||
|
log.Logger.SetLevel(logger.LogLevelDebug)
|
||||||
|
}
|
||||||
|
|
||||||
if *genHash {
|
if *genHash {
|
||||||
fmt.Print("Password: ")
|
fmt.Print("Password: ")
|
||||||
pwd, err := term.ReadPassword(int(os.Stdin.Fd()))
|
pwd, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||||
@@ -87,6 +91,10 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error decoding config file").Err(err).Send()
|
log.Fatal("Error decoding config file").Err(err).Send()
|
||||||
}
|
}
|
||||||
|
err = fl.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Error closing config file").Err(err).Send()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(cfg.Git.RepoDir); os.IsNotExist(err) {
|
if _, err := os.Stat(cfg.Git.RepoDir); os.IsNotExist(err) {
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ job "lure-updater" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
env {
|
env {
|
||||||
GIT_REPO_DIR="/etc/lure-updater/repo"
|
GIT_REPO_DIR = "/etc/lure-updater/repo"
|
||||||
GIT_REPO_URL="https://github.com/Elara6331/lure-repo.git"
|
GIT_REPO_URL = "https://github.com/Elara6331/lure-repo.git"
|
||||||
GIT_CREDENTIALS_USERNAME="lure-repo-bot"
|
GIT_CREDENTIALS_USERNAME = "lure-repo-bot"
|
||||||
GIT_CREDENTIALS_PASSWORD="${GITHUB_PASSWORD}"
|
GIT_CREDENTIALS_PASSWORD = "${GITHUB_PASSWORD}"
|
||||||
GIT_COMMIT_NAME="lure-repo-bot"
|
GIT_COMMIT_NAME = "lure-repo-bot"
|
||||||
GIT_COMMIT_EMAIL="lure@elara.ws"
|
GIT_COMMIT_EMAIL = "lure@elara.ws"
|
||||||
WEBHOOK_PASSWORD_HASH="${PASSWORD_HASH}"
|
WEBHOOK_PASSWORD_HASH = "${PASSWORD_HASH}"
|
||||||
|
|
||||||
// Hack to force Nomad to re-deploy the service
|
// Hack to force Nomad to re-deploy the service
|
||||||
// instead of ignoring it
|
// instead of ignoring it
|
||||||
@@ -41,10 +41,10 @@ job "lure-updater" {
|
|||||||
|
|
||||||
config {
|
config {
|
||||||
image = "alpine:latest"
|
image = "alpine:latest"
|
||||||
|
command = "/opt/lure-updater/lure-updater"
|
||||||
|
args = ["-DE"]
|
||||||
ports = ["webhook"]
|
ports = ["webhook"]
|
||||||
volumes = ["local/lure-updater/:/opt/lure-updater:ro"]
|
volumes = ["local/lure-updater/:/opt/lure-updater:ro"]
|
||||||
command = "/opt/lure-updater/lure-updater"
|
|
||||||
args = ["-E"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact {
|
artifact {
|
||||||
|
|||||||
Reference in New Issue
Block a user