From e786d45e9e8fb3c6f95d450812a403c9697e178b Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Sun, 3 Nov 2024 16:33:02 +0100 Subject: [PATCH] add `NewWithConfig` function for manual config input --- context.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/context.go b/context.go index 2517784..a0fc7fb 100644 --- a/context.go +++ b/context.go @@ -94,12 +94,17 @@ func connectAndMigrate(opts *connectMigrateOpts) (*sql.DB, error) { // parses the "world.mt" file in the world-dir and creates a new context func New(world_dir string) (*Context, error) { - wc, err := worldconfig.Parse(path.Join(world_dir, "world.mt")) if err != nil { return nil, err } + return NewWithConfig(world_dir, wc) +} + +// creates the database context with the given config in map form +func NewWithConfig(world_dir string, wc map[string]string) (*Context, error) { + logrus.WithFields(logrus.Fields{ "world_dir": world_dir, "world.mt": wc,