Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/modules/fxcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ When you use a Yokai `application template`, you have nothing to install, it's r
modules:
core:
server:
port: 8081 # core http server port (default 8081)
address: ":8081" # core http server listener address (default :8081)
errors:
obfuscate: false # to obfuscate error messages on the core http server responses
stack: false # to add error stack trace to error response of the core http server
Expand Down
2 changes: 1 addition & 1 deletion fxcore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ modules:
type: stdout
core:
server:
port: 8081 # core http server port (default 8081)
address: ":8081" # core http server listener address (default :8081)
errors:
obfuscate: false # to obfuscate error messages on the core http server responses
stack: false # to add error stack trace to error response of the core http server
Expand Down
10 changes: 5 additions & 5 deletions fxcore/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

const (
ModuleName = "core"
DefaultPort = 8081
DefaultAddress = ":8081"
DefaultMetricsPath = "/metrics"
DefaultHealthCheckStartupPath = "/healthz"
DefaultHealthCheckLivenessPath = "/livez"
Expand Down Expand Up @@ -135,13 +135,13 @@ func NewFxCore(p FxCoreParam) (*Core, error) {
// lifecycles
p.LifeCycle.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
port := p.Config.GetInt("modules.core.server.port")
if port == 0 {
port = DefaultPort
address := p.Config.GetString("modules.core.server.address")
if address == "" {
address = DefaultAddress
}

//nolint:errcheck
go coreServer.Start(fmt.Sprintf(":%d", port))
go coreServer.Start(address)

return nil
},
Expand Down