Compare commits
3 Commits
ad77710ad1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 26ce3260b9 | |||
| 8dc7bbc6d4 | |||
| 091ad1fec0 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
coverage/*
|
coverage/*
|
||||||
test_monitor.txt
|
test_monitor.txt
|
||||||
bin
|
bin
|
||||||
|
configs/*
|
||||||
15
README.md
15
README.md
@@ -4,7 +4,7 @@ Tool to automatize your deploy based on file write changes
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
After some change is made in our listener file the script placed on path set on `env` variable called **WEBHOOK_SCRIPT_PATH** will be executed.
|
After some change is made in our listener file the script placed on path set on `.yaml` configuration falled placed on `./configs/app.yaml` variable called **webhook_script_path** will be executed.
|
||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
@@ -21,24 +21,21 @@ you shold place on your server to run desired tasks. In my case I've done this t
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- [Go version > 1.19](https://go.dev/dl/)
|
- [Go version > 1.22](https://go.dev/dl/)
|
||||||
- [GNU Make 4.3](https://www.gnu.org/software/make/)
|
- [GNU Make 4.3](https://www.gnu.org/software/make/)
|
||||||
- [goreportcard-cli](https://github.com/gojp/goreportcard)
|
- [goreportcard-cli](https://github.com/gojp/goreportcard)
|
||||||
- [golangci-lint](https://golangci-lint.run/)
|
- [golangci-lint](https://golangci-lint.run/)
|
||||||
|
|
||||||
### Environment Vars
|
### Environment Vars
|
||||||
|
|
||||||
As shown in .env.example you have to configure this variables in order to make your binary works right:
|
As shown in app.example.yml you have to configure this variables in order to make your binary works right:
|
||||||
|
|
||||||
```.env
|
```.env
|
||||||
SCRIPT_BINARY_PATH=/bin/bash
|
script_binary_path: "/bin/bash"
|
||||||
WEBHOOK_SCRIPT_PATH=/path/to/mybashscript.sh
|
webhook_script_path: "./test-script.sh"
|
||||||
FILE_TO_WATCH_PATH=/path/to/myfile.txt
|
file_to_watch_path: "./test_monitor.txt"
|
||||||
TEST_FILE_TO_WATCH_PATH=./test_monitor.txt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**TEST_FILE_TO_WATCH_PATH** is needed just to run tests
|
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
script_binary_path: "/bin/bash"
|
|
||||||
webhook_script_path: "./test-script.sh"
|
|
||||||
file_to_watch_path: "./test_monitor.txt"
|
|
||||||
9
main.go
9
main.go
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -18,13 +17,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
envFilePath := ""
|
config, err := config.LoadConfig("./configs/app.yaml")
|
||||||
if os.Getenv("ENV") != "prod" {
|
|
||||||
flag.StringVar(&envFilePath, ".env path", "/", "provide .env path file as an absolute path")
|
|
||||||
flag.Parse()
|
|
||||||
}
|
|
||||||
|
|
||||||
config, err := config.LoadConfig(envFilePath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user