Skip to content

Commit

Permalink
Fix: prevent assertion and modify config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Dec 13, 2023
1 parent 4c466de commit db49353
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions internal/sbi/consumer/nf_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ func SendNFRegistration() error {

oauth2 := false
if nf.CustomInfo != nil {
oauth2 = nf.CustomInfo["oauth2"].(bool)
v, ok := nf.CustomInfo["oauth2"].(bool)
if ok {
oauth2 = v
logger.MainLog.Infoln("OAuth2 setting receive from NRF:", oauth2)
}
}
smf_context.GetSelf().OAuth2Required = oauth2
logger.MainLog.Infoln("OAuth2 setting receive from NRF:", oauth2)
if oauth2 && smf_context.GetSelf().NrfCertPem == "" {
logger.CfgLog.Error("OAuth2 enable but no nrfCertPem provided in config.")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type Configuration struct {
Sbi *Sbi `yaml:"sbi" valid:"required"`
PFCP *PFCP `yaml:"pfcp" valid:"required"`
NrfUri string `yaml:"nrfUri" valid:"url,required"`
NrfCertPem string `yaml:"nrfCertPem,omitempty" valid:"type(string),optional"`
NrfCertPem string `yaml:"nrfCertPem,omitempty" valid:"optional"`
UserPlaneInformation UserPlaneInformation `yaml:"userplaneInformation" valid:"required"`
ServiceNameList []string `yaml:"serviceNameList" valid:"required"`
SNssaiInfo []*SnssaiInfoItem `yaml:"snssaiInfos" valid:"required"`
Expand Down

0 comments on commit db49353

Please sign in to comment.