mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: Customization of the initialization file (#1936)
This commit is contained in:
@ -22,3 +22,4 @@ batchSize = 100
|
|||||||
ldapServerPort = 389
|
ldapServerPort = 389
|
||||||
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
|
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
|
||||||
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"}
|
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"}
|
||||||
|
initDataFile = "./init_data.json"
|
@ -14,7 +14,10 @@
|
|||||||
|
|
||||||
package object
|
package object
|
||||||
|
|
||||||
import "github.com/casdoor/casdoor/util"
|
import (
|
||||||
|
"github.com/casdoor/casdoor/conf"
|
||||||
|
"github.com/casdoor/casdoor/util"
|
||||||
|
)
|
||||||
|
|
||||||
type InitData struct {
|
type InitData struct {
|
||||||
Organizations []*Organization `json:"organizations"`
|
Organizations []*Organization `json:"organizations"`
|
||||||
@ -35,7 +38,12 @@ type InitData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InitFromFile() {
|
func InitFromFile() {
|
||||||
initData, err := readInitDataFromFile("./init_data.json")
|
initDataFile := conf.GetConfigString("initDataFile")
|
||||||
|
if initDataFile == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
initData, err := readInitDataFromFile(initDataFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user