Fix jester options (port, appName).
This commit is contained in:
parent
3e8bbb1676
commit
b402a8eb6d
@ -1,4 +1,4 @@
|
|||||||
import logging, nre, os, osproc, sequtils, streams, strtabs, strutils, tables, tempfile
|
import logging, nre, os, osproc, sequtils, streams, strtabs, strutils, tables
|
||||||
|
|
||||||
import private/util
|
import private/util
|
||||||
import configuration
|
import configuration
|
||||||
|
@ -3,9 +3,6 @@ import asyncdispatch, bcrypt, jester, json, jwt, os, osproc, sequtils, tempfile,
|
|||||||
|
|
||||||
import ./configuration, ./core, private/util
|
import ./configuration, ./core, private/util
|
||||||
|
|
||||||
settings:
|
|
||||||
port = Port(8180)
|
|
||||||
|
|
||||||
type Worker = object
|
type Worker = object
|
||||||
process*: Process
|
process*: Process
|
||||||
workingDir*: string
|
workingDir*: string
|
||||||
@ -114,23 +111,26 @@ proc start*(givenCfg: StrawBossConfig): void =
|
|||||||
let stopFuture = newFuture[void]()
|
let stopFuture = newFuture[void]()
|
||||||
var workers: seq[Worker] = @[]
|
var workers: seq[Worker] = @[]
|
||||||
|
|
||||||
|
settings:
|
||||||
|
port = Port(8180)
|
||||||
|
appName = "/api"
|
||||||
|
|
||||||
routes:
|
routes:
|
||||||
get "/api/ping":
|
get "/ping":
|
||||||
resp($(%*"pong"), "application/json")
|
resp($(%*"pong"), "application/json")
|
||||||
|
|
||||||
get "/api/auth-token":
|
get "/auth-token":
|
||||||
resp(Http501, makeJsonResp(Http501), "application/json")
|
echo $request.params
|
||||||
|
try:
|
||||||
|
let authToken = makeAuthToken(givenCfg, @"username", @"password")
|
||||||
|
resp("\"" & $authToken & "\"", "application/json")
|
||||||
|
except: resp(Http401, makeJsonResp(Http401, getCurrentExceptionMsg()))
|
||||||
|
|
||||||
get "/api/projects":
|
get "/projects":
|
||||||
requireAuth()
|
requireAuth()
|
||||||
resp($(%(givenCfg.projects)), "application/json")
|
resp($(%(givenCfg.projects)), "application/json")
|
||||||
|
|
||||||
get "/api/auth-token":
|
post "/project/@projectName/@stepName/run/@buildRef?":
|
||||||
try:
|
|
||||||
let authToken = makeAuthToken(givenCfg, @"username", @"password")
|
|
||||||
except: resp(Http401, makeJsonResp(Http401, getCurrentExceptionMsg()))
|
|
||||||
|
|
||||||
post "/api/project/@projectName/@stepName/run/@buildRef?":
|
|
||||||
workers.add(spawnWorker(RunRequest(
|
workers.add(spawnWorker(RunRequest(
|
||||||
projectName: @"projectName",
|
projectName: @"projectName",
|
||||||
stepName: @"stepName",
|
stepName: @"stepName",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user