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 67b1afe commit 2806eb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions internal/sbi/consumer/nf_mangement.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,15 @@ func SendRegisterNFInstance(nrfUri, nfInstanceId string, profile models.NfProfil

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)
}
}
amf_context.GetSelf().OAuth2Required = oauth2
logger.MainLog.Infoln("OAuth2 setting receive from NRF:", oauth2)
if oauth2 && amf_context.GetSelf().NrfCertPem == "" {
logger.CfgLog.Error("OAuth2 enable but no NrfCertPem provided in config.")
logger.CfgLog.Error("OAuth2 enable but no nrfCertPem provided in config.")
}

break
Expand Down
2 changes: 1 addition & 1 deletion pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Configuration struct {
SupportDnnList []string `yaml:"supportDnnList,omitempty" valid:"required"`
SupportLadnList []Ladn `yaml:"supportLadnList,omitempty" valid:"optional"`
NrfUri string `yaml:"nrfUri,omitempty" valid:"required, url"`
NrfCertPem string `yaml:"nrfCertPem,omitempty" valid:"type(string),optional"`
NrfCertPem string `yaml:"nrfCertPem,omitempty" valid:"optional"`
Security *Security `yaml:"security,omitempty" valid:"required"`
NetworkName NetworkName `yaml:"networkName,omitempty" valid:"required"`
NgapIE *NgapIE `yaml:"ngapIE,omitempty" valid:"optional"`
Expand Down

0 comments on commit 2806eb5

Please sign in to comment.