Skip to content

Commit 9e092a9

Browse files
authored
feat(fxcore): Added support for listener address (#206)
1 parent 1a74562 commit 9e092a9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/modules/fxcore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ When you use a Yokai `application template`, you have nothing to install, it's r
4646
modules:
4747
core:
4848
server:
49-
port: 8081 # core http server port (default 8081)
49+
address: ":8081" # core http server listener address (default :8081)
5050
errors:
5151
obfuscate: false # to obfuscate error messages on the core http server responses
5252
stack: false # to add error stack trace to error response of the core http server

fxcore/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ modules:
8282
type: stdout
8383
core:
8484
server:
85-
port: 8081 # core http server port (default 8081)
85+
address: ":8081" # core http server listener address (default :8081)
8686
errors:
8787
obfuscate: false # to obfuscate error messages on the core http server responses
8888
stack: false # to add error stack trace to error response of the core http server

fxcore/module.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
const (
3434
ModuleName = "core"
35-
DefaultPort = 8081
35+
DefaultAddress = ":8081"
3636
DefaultMetricsPath = "/metrics"
3737
DefaultHealthCheckStartupPath = "/healthz"
3838
DefaultHealthCheckLivenessPath = "/livez"
@@ -135,13 +135,13 @@ func NewFxCore(p FxCoreParam) (*Core, error) {
135135
// lifecycles
136136
p.LifeCycle.Append(fx.Hook{
137137
OnStart: func(ctx context.Context) error {
138-
port := p.Config.GetInt("modules.core.server.port")
139-
if port == 0 {
140-
port = DefaultPort
138+
address := p.Config.GetString("modules.core.server.address")
139+
if address == "" {
140+
address = DefaultAddress
141141
}
142142

143143
//nolint:errcheck
144-
go coreServer.Start(fmt.Sprintf(":%d", port))
144+
go coreServer.Start(address)
145145

146146
return nil
147147
},

0 commit comments

Comments
 (0)