<FromGitter>
<jrei:matrix.org> moe (https://matrix.to/#/@moe:busyloop.net): multiple servers should be possible in a same app, otherwise it not a good sign of how the code is designed
<FromGitter>
<jrei:matrix.org> There are cases like serving the swager docs in one interface + port, like localhost:8000, and the app to 0.0.0.0:8888
<FromGitter>
<jrei:matrix.org> If @Blacksmoke16 and me did it, you can too
<FromGitter>
<moe:busyloop.net> yup, i tend to agree. will be added at some point, it's totally doable. just not a high prio atm because... when was the last time you actually needed it? ;) ⏎ ⏎ for me swagger is served on `/` by default. if it's a private api then there's auth on it (as per zero trust model). i don't remember ever encountering a case where multiple isolated appservers in one process was really needed. when it
<FromGitter>
... happens it's more often an artefact of e.g. wanting to serve prometheus metrics with an external lib. however, in that case that lib does its own HTTP::Server stuff anyway.
<FromGitter>
<moe:busyloop.net> but yea, even if only for aesthetics, being a singleton doesn't feel right long-term ;)
<FromGitter>
<Blacksmoke16> fwiw in athena the only way to have two servers is with two binaries
ur5us has joined #crystal-lang
wmoxam has joined #crystal-lang
wmoxam has quit [Client Quit]
ur5us has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
pixel has joined #crystal-lang
miketheman has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
dom96 has quit [*.net *.split]
miketheman has joined #crystal-lang
dom96 has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 240 seconds]
jmdaemon has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 240 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 248 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 248 seconds]
<FromGitter>
<jrei:matrix.org> I meant a bad sign because usually when we can do 2 servers, it means there are global vars around
<FromGitter>
<jrei:matrix.org> The way I did it is to re-implement partially HTTP::Server, which is like 20 lines of code so that's ok
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 240 seconds]
<FromGitter>
<moe:busyloop.net> yea, it's not really global vars here, just all those generated classes, but should be straightforward to namespace them
taupiqueur has joined #crystal-lang
<FromGitter>
<jrei:matrix.org> What about in specs?
<FromGitter>
<jrei:matrix.org> It is not possible to run multiple servers, or instantiate multiple ones?
sagax has joined #crystal-lang
<FromGitter>
<moe:busyloop.net> in spec the server doesn't even run 🤷 i pasted my helper somewhere above, it just instantiates requests and feeds them to the framework in the same way that HTTP::Server would
taupiqueur has quit [Ping timeout: 246 seconds]
taupiqueur has joined #crystal-lang
<FromGitter>
<Blacksmoke16> same ^, athena is also technically decoupled from `HTTP::Server` as well. You could manually pass it an `HTTP::Request` and get back the `ATH::Response` then manually apply it to whatever. Main use case for this would be like serverless contexts. E.g https://github.com/awcrotwell/serverless.cr/blob/master/src/serverless/ext/athena.cr
<FromGitter>
<jrei:matrix.org> I mainly meant 2 instances of your framework object
notzmv has quit [Ping timeout: 248 seconds]
<FromGitter>
<jrei:matrix.org> If I understood correctly the limitation is when we to actually run the server, not when calling the framework directly in specs
<FromGitter>
<Blacksmoke16> you could create two instances, but the catch is there technically is global vars involved given i didnt implement a way to filter which controllers are handled by a specific instance. Hence just using two binaries that only require the ones they want is wayy easier