diff --git a/.gitignore b/.gitignore index d13c162..11b4d34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.log *.pid +.env \ No newline at end of file diff --git a/README.md b/README.md index e0cf04d..8e79236 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # kiviscrapbalancer -Kivi scraping load balancer \ No newline at end of file +Kivi scraping load balancer + +## Setup + +Copy `example.env` to the `.env` and set desired values \ No newline at end of file diff --git a/example.env b/example.env new file mode 100644 index 0000000..0f8359c --- /dev/null +++ b/example.env @@ -0,0 +1,9 @@ +# Check default values in kiviscraplib/config/config.go + +WEB_SERVER_ADDRESS = Address in form of IP:PORT (127.0.0.1:1337) on which web server will listen for scrap requests +WEB_SERVER_API_KEY = API key that needs to be present in scrap request +WEB_SERVER_TIMEOUT = Number of seconds to wait for worker client before timeout-ing scrap requests + +WORKER_SERVER_ADDRESS = Address in form of IP:PORT (127.0.0.1:1338) on which worker server will listen for worker clients +WORKER_SERVER_WORKERS_COUNT = Number of possible worker clients +WORKER_SERVER_REQUEST_MESSAGE_PREFIX = Prefix to prepend on the request message when sending to the worker client. Use double quotes if prefix has a space (eg. "URL ") \ No newline at end of file diff --git a/main.go b/main.go index c19e016..58e8ba4 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/sevlyar/go-daemon" + "gitlab.com/saburly/kiviscraplib/config" "gitlab.com/saburly/kiviscraplib/structures" "gitlab.com/saburly/kiviscraplib/webserver" "gitlab.com/saburly/kiviscraplib/workerserver" @@ -14,6 +15,8 @@ var end chan string // To terminate the daemon use: // kill `cat sample.pid` func main() { + config.InitServerConfig() + cntxt := &daemon.Context{ PidFileName: "sample.pid", PidFilePerm: 0644,