finished init command - it now initialises the stuff

This commit is contained in:
Senad Uka
2015-05-29 21:10:00 +02:00
parent 67d5350589
commit aa0b472cb1
3 changed files with 82 additions and 19 deletions

View File

@@ -1,8 +1,39 @@
package globals
import (
"fmt"
"strconv"
"os"
)
const (
ConfigurationFolderName = ".chub"
ConfigurationFilePermissions = 600
ConfigurationFileName = "config"
UrlOfTheService = "confighub.meteor.com"
UrlOfTheService = "http://localhost:3000/api/"
MimeTypeOfService = "application/json"
)
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
}