Skip to content

Commit

Permalink
go server, make http server addr configurable
Browse files Browse the repository at this point in the history
* prepares for running within containers
  • Loading branch information
BuJo committed Oct 2, 2024
1 parent b8db0fb commit c7141ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/tales-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
var (
resourcesDir string
projectsDir string
bindAddr string
)

func init() {
Expand All @@ -29,6 +30,7 @@ func init() {
func main() {
flag.StringVar(&resourcesDir, "resources", "", "path to public resources")
flag.StringVar(&projectsDir, "projects", defaultProjectsDir(), "path to projects")
flag.StringVar(&bindAddr, "bind", "127.0.0.1:3000", "HTTP server address")
flag.Parse()

log.Printf("Starting tales-server %s (%s)",
Expand Down Expand Up @@ -58,7 +60,7 @@ func main() {

server := http.Server{
Handler: web.NewServer(projectsDir, resourceFS),
Addr: "127.0.0.1:3000",
Addr: bindAddr,
WriteTimeout: 10 * time.Second,
ReadTimeout: 10 * time.Second,
}
Expand Down

0 comments on commit c7141ff

Please sign in to comment.