Skip to content

Commit

Permalink
Make server listen address configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
eest committed Dec 18, 2024
1 parent 1870e21 commit 3ae7897
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ var (
errAlreadyExists = errors.New("resource already exists")
)

type config struct {
DB dbSettings
type Config struct {
Server serverSettings
DB dbSettings
}

type serverSettings struct {
Addr string
}

type dbSettings struct {
Expand Down Expand Up @@ -1660,7 +1665,7 @@ func Run(logger zerolog.Logger) {
}

srv := &http.Server{
Addr: "127.0.0.1:8080",
Addr: conf.Server.Addr,
Handler: router,
ReadTimeout: time.Second * 10,
WriteTimeout: time.Second * 10,
Expand Down

0 comments on commit 3ae7897

Please sign in to comment.