carsten-wenderdel / wildbg

Backgammon engine based on neural networks
https://wildbg.shuttleapp.rs/swagger-ui/
Apache License 2.0
18 stars 5 forks source link

Configure server.rs to accept address and port #25

Closed th3oth3rjak3 closed 5 months ago

th3oth3rjak3 commented 5 months ago

Also add clap to parse cli args.

This fixes #23

carsten-wenderdel commented 5 months ago

This looks good, thanks a lot!

One detail however: When cargo run is executed without arguments, the following is printed to the command line:

You can access the server for example via
http://0.0.0.0:8080/move?die1=3&die2=1&p24=2&p19=-5&p17=-3&p13=5&p12=-5&p8=3&p6=5&p1=-2
http://0.0.0.0:8080/swagger-ui

Those links don't work, at least not in my browser.

Maybe we could print out localhost instead of 0.0.0.0 if no argument for address is given? Or maybe we use 127.0.0.1 as default address instead?

th3oth3rjak3 commented 5 months ago

Oh, interesting, yeah they're not working for me either. I think you're right that a good default would be 127.0.0.1 for local development. When deployed to production would you want these links to show up in the logs? I'll play around a bit and see if I can come up with a flexible solution.

carsten-wenderdel commented 5 months ago

Regarding logs in production - I would keep it simple for now. Unless @tslocum has some special requests - he is currently the only one who has server.rs in production.

carsten-wenderdel commented 5 months ago

Nice, thank you!