mirror of
https://github.com/KevinMidboe/planetposen-images.git
synced 2025-10-29 13:20:11 +00:00
App for fetching and uploading images to cloud bucket storage
This commit is contained in:
8
util/geturl.go
Normal file
8
util/geturl.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package util
|
||||
|
||||
import "fmt"
|
||||
|
||||
// ImageURL creates imageURL from hostname and image name
|
||||
func ImageURL(hostname, name string) string {
|
||||
return fmt.Sprintf("https://%s/api/v1/images/%s", hostname, name)
|
||||
}
|
||||
14
util/hash.go
Normal file
14
util/hash.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Hash hashes a string using sha1
|
||||
func Hash(s string) string {
|
||||
hash := sha1.New()
|
||||
_, _ = hash.Write([]byte(s))
|
||||
bs := hash.Sum(nil)
|
||||
return fmt.Sprintf("%x", bs)
|
||||
}
|
||||
Reference in New Issue
Block a user