mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-04-27 09:39:23 -05:00
40 lines
675 B
Go
40 lines
675 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
//needs to be changed in ./templates/string_constants.tmpl as well
|
|
const VERSION = "1.0"
|
|
|
|
func main() {
|
|
rand.Seed(time.Now().UnixNano())
|
|
fmt.Println("Gokapi v" + VERSION + " starting")
|
|
createDataDir()
|
|
loadConfig()
|
|
checkArguments()
|
|
initTemplates()
|
|
go cleanUpOldFiles(true)
|
|
startWebserver()
|
|
}
|
|
|
|
func checkArguments() {
|
|
if len(os.Args) > 1 {
|
|
if os.Args[1] == "--reset-pw" {
|
|
fmt.Println("Password change requested")
|
|
globalConfig.AdminPassword = hashPassword(askForPassword())
|
|
saveConfig()
|
|
}
|
|
}
|
|
}
|
|
|
|
func createDataDir() {
|
|
if !folderExists("data") {
|
|
err := os.Mkdir("data", 0770)
|
|
check(err)
|
|
}
|
|
}
|