package
0.0.0-20151215094434-9aa9c3bf18f3
Repository: https://github.com/itshosted/mcore.git
Documentation: pkg.go.dev

# README

Config loader

Remove duplicate code from multiple projects into one.

package config

import (
	"github.com/xsnews/mcore/config"
)

type Config struct {
	// TODO: body here
}

var C Config

func Init(filename string) error {
	return config.Load(filename, &C)
}

Load files from a conf.d

package main

import (
  "github.com/xsnews/mcore/config"
)

type Host struct {
  Ip   string
  Port int
}

func main() {
  hosts := make(map[string]Host)

  err := config.LoadJsonD("./conf.d/", &hosts)
  if err != nil {
          panic(err)
  }
}

# Functions

Parse JSON from given path.
Read files from basedir and convert JSON to map[filename]type Note: Dir should end with .d suffix (Debian/XSNews convention) Note: Only .json-files should exist in this dir Note: Subdirs not allowed in basedir.

# Variables

No description provided by the author
No description provided by the author