Skip to content

Commit

Permalink
Added constant for namespace
Browse files Browse the repository at this point in the history
Signed-off-by: ItalyPaleAle <[email protected]>
  • Loading branch information
ItalyPaleAle committed Oct 14, 2023
1 parent a08a58f commit 6dfe0c1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions nameresolution/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
AppPort string = "APP_PORT"
// AppID is the ID of the application.
AppID string = "APP_ID"
// Namespace is the namespace of the application.
Namespace string = "NAMESPACE"
)

// Metadata contains a name resolution specific set of metadata properties.
Expand All @@ -53,7 +55,8 @@ func (m Metadata) GetDaprHTTPPort() int {
return p
}

// GetDaprPort returns the host address property.
// GetDaprPort returns the Dapr port property.
// If the port is invalid, returns 0.
func (m Metadata) GetDaprPort() int {
p, _ := strconv.Atoi(m.Properties[DaprPort])
if p < 0 {
Expand All @@ -62,7 +65,8 @@ func (m Metadata) GetDaprPort() int {
return p
}

// GetAppPort returns the host address property.
// GetAppPort returns the app port property.
// If the port is invalid, returns 0.
func (m Metadata) GetAppPort() int {
p, _ := strconv.Atoi(m.Properties[AppPort])
if p < 0 {
Expand All @@ -71,7 +75,12 @@ func (m Metadata) GetAppPort() int {
return p
}

// GetAppID returns the host address property.
// GetAppID returns the app ID property.
func (m Metadata) GetAppID() string {
return m.Properties[AppID]
}

// GetNamespace returns the namespace property.
func (m Metadata) GetNamespace() string {
return m.Properties[AppID]
}

0 comments on commit 6dfe0c1

Please sign in to comment.