palantir / witchcraft-go-server

A highly opinionated Go embedded application server for RESTy APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Server field to witchcraft.InitInfo

bmoylan opened this issue · comments

Some initialization functions require a way of launching a goroutine that may eventually call Shutdown on the server. Currently this is being worked around by creating the initFn as a variable after constructing the server, using a reference to the server inside the anonymous function, then setting the initFn on the server before starting it.

Instead, we could provide a Server field on InitInfo. It should have descriptive documentation explaining the state(s) the server can be in when initfn is called.