Skip to content

A package for reading/writing MongoDB yaml-based configurations

License

Notifications You must be signed in to change notification settings

timvaillancourt/go-mongodb-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-mongodb-config

Build Status Go Report Card codecov

A package for reading/writing MongoDB yaml-based configurations

Docs

Usage

Create 'Config' struct from file (YAML-based only):

import (
	mongodb_config "github.com/timvaillancourt/go-mongodb-config/config"
)

func main() {
	config, err := mongodb_config.Load("/etc/mongod.conf")
	if err != nil {
		panic(err)
	}
	...
}

Create 'Config' struct from uri:

import (
        mongodb_config "github.com/timvaillancourt/go-mongodb-config/config"
)

func main() {
        config, err := mongodb_config.LoadUri("http://example.com/etc/mongod.conf")
        if err != nil {
                panic(err)
        }
        ...
}

Write 'Config' struct to file:

import (
	mongodb_config "github.com/timvaillancourt/go-mongodb-config/config"
)
 
func main() {
	config := mongodb_config.New()
	...
	err := config.Write("/etc/mongod.conf")
	if err != nil {
		panic(err)
	}
}

About

A package for reading/writing MongoDB yaml-based configurations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages