forked from gomods/athens
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added configurable CDN endpoint (gomods#214)
* added configurable cdn endpoint
- Loading branch information
1 parent
fda6ec5
commit c02e9c0
Showing
4 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package env | ||
|
||
import ( | ||
"net/url" | ||
|
||
"github.com/gobuffalo/envy" | ||
) | ||
|
||
// CDNEndpointWithDefault returns CDN endpoint if set | ||
// if not it should default to clouds default blob storage endpoint e.g | ||
func CDNEndpointWithDefault(value *url.URL) *url.URL { | ||
rawURI, err := envy.MustGet("CDN_ENDPOINT") | ||
if err != nil { | ||
return value | ||
} | ||
|
||
uri, err := url.Parse(rawURI) | ||
if err != nil { | ||
return value | ||
} | ||
|
||
return uri | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters