mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d41f0c347 | ||
|
|
b22f0551fa | ||
|
|
1a906cfc09 | ||
|
|
f610667aa5 |
@@ -30,7 +30,12 @@ func BuildKey(username string) string {
|
||||
}
|
||||
|
||||
func BuildElyUrl(route string) string {
|
||||
return "http://ely.by" + route
|
||||
prefix := "http://ely.by"
|
||||
if !strings.HasPrefix(route, prefix) {
|
||||
route = prefix + route
|
||||
}
|
||||
|
||||
return route
|
||||
}
|
||||
|
||||
func getCurrentHour() int64 {
|
||||
|
||||
@@ -20,3 +20,13 @@ func TestBuildKey(t *testing.T) {
|
||||
t.Error("Function shound convert string to lower case and concatenate it with usernmae:")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildElyUrl(t *testing.T) {
|
||||
if BuildElyUrl("/route") != "http://ely.by/route" {
|
||||
t.Error("Function should add prefix to the provided relative url.")
|
||||
}
|
||||
|
||||
if BuildElyUrl("http://ely.by/test/route") != "http://ely.by/test/route" {
|
||||
t.Error("Function should do not add prefix to the provided prefixed url.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ func main() {
|
||||
|
||||
// statsd
|
||||
var statsdString = os.Getenv("STATSD_ADDR")
|
||||
statsdString = ""
|
||||
if (statsdString != "") {
|
||||
log.Println("Connecting to statsd")
|
||||
hostname, _ := os.Hostname()
|
||||
|
||||
Reference in New Issue
Block a user