worker: Make BasePath configurable

This commit is contained in:
sanne 2021-10-07 14:03:19 +02:00 committed by Ondřej Budai
parent 6ce20a9ef6
commit ce7ac9a756
11 changed files with 106 additions and 25 deletions

View file

@ -41,12 +41,15 @@ type JobStatus struct {
var ErrInvalidToken = errors.New("token does not exist")
var ErrJobNotRunning = errors.New("job isn't running")
func NewServer(logger *log.Logger, jobs jobqueue.JobQueue, artifactsDir string) *Server {
func NewServer(logger *log.Logger, jobs jobqueue.JobQueue, artifactsDir string, basePath string) *Server {
s := &Server{
jobs: jobs,
logger: logger,
artifactsDir: artifactsDir,
}
api.BasePath = basePath
go s.WatchHeartbeats()
return s
}