guichet/main.go

46 lines
719 B
Go
Raw Normal View History

2023-07-21 04:23:03 +00:00
/*
Guichet provides a user-management system around an LDAP Directory
Oriniated with deuxfleurs.fr and advanced by resdigita.com
*/
2020-02-09 13:46:52 +00:00
package main
import (
2020-02-09 14:01:20 +00:00
"crypto/rand"
2023-07-21 04:37:18 +00:00
// "crypto/tls"
2023-07-21 04:23:03 +00:00
// "encoding/json"
2020-02-09 15:46:26 +00:00
"flag"
2023-07-21 04:23:03 +00:00
// "fmt"
// "io/ioutil"
2020-02-09 15:46:26 +00:00
"log"
2023-07-21 04:23:03 +00:00
// "os"
2023-07-25 19:35:22 +00:00
// "strings"
2020-02-09 13:46:52 +00:00
2020-02-09 22:04:37 +00:00
"github.com/gorilla/sessions"
2020-02-09 13:46:52 +00:00
)
2020-02-09 14:44:18 +00:00
const SESSION_NAME = "guichet_session"
2020-02-09 15:46:26 +00:00
var store sessions.Store = nil
2020-02-09 13:46:52 +00:00
func main() {
2023-07-25 19:35:22 +00:00
2020-02-09 14:01:20 +00:00
flag.Parse()
2020-02-09 13:46:52 +00:00
2020-02-09 14:44:18 +00:00
config_file := readConfig()
config = &config_file
2020-02-10 14:26:02 +00:00
session_key := make([]byte, 32)
n, err := rand.Read(session_key)
if err != nil || n != 32 {
log.Fatal(err)
}
store = sessions.NewCookieStore(session_key)
2023-07-25 19:35:22 +00:00
_, err = makeGVRouter()
2020-02-09 13:46:52 +00:00
if err != nil {
log.Fatal("Cannot start http server: ", err)
}
}