Skip to content

Commit

Permalink
Rebase and modify config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Nov 30, 2023
1 parent ee575da commit 8d10e71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/free5gc/udr
go 1.17

require (
github.com/antihax/optional v1.0.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/evanphx/json-patch v0.5.2
github.com/free5gc/openapi v1.0.7-0.20231112094355-a96c3450377e
Expand All @@ -15,11 +14,11 @@ require (
github.com/stretchr/testify v1.8.3
github.com/urfave/cli v1.22.5
go.mongodb.org/mongo-driver v1.8.4
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/antihax/optional v1.0.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/datarepository/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func HandleAppDataInfluDataSubsToNotifyConflictPut(c *gin.Context) {
func authorizationCheck(c *gin.Context) error {
if factory.UdrConfig.GetOAuth() {
oauth_err := oauth.VerifyOAuth(c.Request.Header.Get("Authorization"), "nudr-dr",
factory.UdrConfig.GetNrfCertPemPath())
factory.UdrConfig.GetNrfCerPem())
if oauth_err != nil {
c.JSON(http.StatusUnauthorized, gin.H{"error": oauth_err.Error()})
return oauth_err
Expand Down
13 changes: 7 additions & 6 deletions pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ type ServiceList struct {
}

type Configuration struct {
Sbi *Sbi `yaml:"sbi" valid:"required"`
Mongodb *Mongodb `yaml:"mongodb" valid:"required"`
NrfUri string `yaml:"nrfUri" valid:"url,required"`
NrfCerPem string `yaml:"nrfCerPem,omitempty" valid:"type(string),minstringlength(1),optional"`
Sbi *Sbi `yaml:"sbi" valid:"required"`
ServiceList []ServiceList `yaml:"serviceList" valid:"optional"`
Mongodb *Mongodb `yaml:"mongodb" valid:"required"`
NrfUri string `yaml:"nrfUri" valid:"url,required"`
NrfCerPem string `yaml:"nrfCerPem,omitempty" valid:"type(string),minstringlength(1),optional"`
}

type Logger struct {
Expand All @@ -90,10 +91,10 @@ type Sbi struct {
OAuth bool `yaml:"oauth,omitempty" valid:"optional"`
}

func (c *Config) GetNrfCertPemPath() string {
func (c *Config) GetNrfCerPem() string {
c.RLock()
defer c.RUnlock()
return c.Configuration.NrfCertPemPath
return c.Configuration.NrfCerPem
}

func (c *Config) GetOAuth() bool {
Expand Down

0 comments on commit 8d10e71

Please sign in to comment.