-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
954d3d1
commit 596b747
Showing
2 changed files
with
42 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/securitybunker/databunker/src/storage" | ||
) | ||
|
||
func init() { | ||
log.Printf("**INIT*TEST*CODE***\n") | ||
testDBFile := storage.CreateTestDB() | ||
db, myRootToken, err := setupDB(&testDBFile, nil, "") | ||
if err != nil { | ||
log.Printf("Init error %s", err.Error()) | ||
} | ||
rootToken = myRootToken | ||
var cfg Config | ||
cfile := "../databunker.yaml" | ||
err = readConfFile(&cfg, &cfile) | ||
cfg.SelfService.AppRecordChange = []string{"testapp", "super"} | ||
if err != nil { | ||
cfg.SelfService.ForgetMe = false | ||
cfg.SelfService.UserRecordChange = true | ||
cfg.Generic.CreateUserWithoutAccessToken = true | ||
//cfg.Generic.UseSeparateAppTables = true | ||
cfg.Policy.MaxUserRetentionPeriod = "1m" | ||
cfg.Policy.MaxAuditRetentionPeriod = "12m" | ||
cfg.Policy.MaxSessionRetentionPeriod = "1h" | ||
cfg.Policy.MaxShareableRecordRetentionPeriod = "1m" | ||
} | ||
e = mainEnv{db, cfg, make(chan struct{})} | ||
rootToken2, err := e.db.getRootXtoken() | ||
if err != nil { | ||
log.Printf("Failed to retrieve root token: %s\n", err) | ||
} | ||
log.Printf("Hashed root token: %s\n", rootToken2) | ||
router = e.setupRouter() | ||
router = e.setupConfRouter(router) | ||
//test1 := &testEnv{e, rootToken, router} | ||
e.dbCleanupDo() | ||
log.Printf("**INIT*DONE***\n") | ||
} |