Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
b5871d7a
Commit
b5871d7a
authored
Apr 07, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make env var parsing more robust
parent
624dad3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
kubernetes.go
pkg/util/kubernetes.go
+8
-1
No files found.
pkg/util/kubernetes.go
View file @
b5871d7a
...
...
@@ -20,6 +20,7 @@ import (
"fmt"
"log"
"net"
"net/url"
"os"
"strings"
)
...
...
@@ -77,7 +78,13 @@ func GetServiceURL(serviceName, servicePort, serviceURL string) (string, error)
varName
:=
strings
.
ToUpper
(
varBase
)
+
"_PORT"
serviceURL
:=
os
.
Getenv
(
varName
)
if
serviceURL
!=
""
{
return
strings
.
Replace
(
serviceURL
,
"tcp"
,
"http"
,
1
),
nil
u
,
err
:=
url
.
Parse
(
serviceURL
)
if
err
!=
nil
||
u
.
Path
!=
""
||
u
.
Scheme
!=
"tcp"
{
return
""
,
fmt
.
Errorf
(
"malformed value: %s for envinronment variable: %s"
,
serviceURL
,
varName
)
}
u
.
Scheme
=
"http"
return
u
.
String
(),
nil
}
if
servicePort
!=
""
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment