1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Introduce flag to recompute summaries from raw events instead of using aggregations.

This commit is contained in:
Ferdinand Mütsch
2019-11-07 12:56:05 +01:00
parent f3fe8124c8
commit 9e726028c3
4 changed files with 22 additions and 14 deletions

View File

@ -170,12 +170,7 @@ func migrateLanguages(db *gorm.DB, cfg *models.Config) {
func addDefaultUser(db *gorm.DB, cfg *models.Config) {
pw := md5.Sum([]byte(models.DefaultPassword))
pwString := hex.EncodeToString(pw[:])
var err error
apiKey := uuid.Must(uuid.NewV4(), err).String()
if err != nil {
log.Println("Unable to create api key.")
log.Fatal(err)
}
apiKey := uuid.NewV4().String()
u := &models.User{ID: models.DefaultUser, Password: pwString, ApiKey: apiKey}
result := db.FirstOrCreate(u, &models.User{ID: u.ID})
if result.Error != nil {