Files
old-confighub/chub/globals/globals.go

40 lines
862 B
Go
Raw Normal View History

package globals
import (
"fmt"
"strconv"
"os"
)
const (
2015-05-30 11:02:31 +02:00
ConfigurationDirectoryName = ".chub"
ConfigurationFilePermissions = 600
ConfigurationFileName = "config"
UrlOfTheService = "http://localhost:3000/api/"
MimeTypeOfService = "application/json"
2015-05-30 11:02:31 +02:00
WebSite = "http://confighub.saburly.com"
)
func PanicWithStyle(message string, err error) {
if err != nil {
panic(fmt.Sprintf("%v:\n%v", message, err))
}
}
func RuneToAscii(r rune) string {
if r < 128 {
return string(r)
} else {
return "\\u" + strconv.FormatInt(int64(r), 16)
}
}
func FileExists(path string) (bool) {
_, err := os.Stat(path)
if err == nil { return true }
if os.IsNotExist(err) { return false }
PanicWithStyle("This should not be happening. Call 911 !" , err)
return false
}