Giter Site home page Giter Site logo

boost's Introduction

Boost

godoc

Scripted Lua configuration for Go!

boosters

Boost is a simple configuration engine driven by Lua scripts.

Install

This package is go get-able so I'm sure you know what to do... (but just in case you don't โ†ฒ)

go get github.com/cosmotek/boost

Example

In addition to the example below, I've included an much more detailed example in the examples folder.

example.conf

-- some global values
random = {
  one = 1,
  two = 2,
  strawberries = "red"
}

-- configuration function
MyApp.configure = function(config)
  config.favorites.fruits = {
    "apple",
    "orange"
  }

  config.favorites.color = "red"
  config.favorites.animals = true
end

main.go

package main

import (
	"fmt"

	"github.com/cosmotek/boost"
	"github.com/cosmotek/boost/types"
)

type Configuration struct {
	Favorites struct {
    Color string
    Animals bool
    Fruits []string
  }
}

func main() {
	conf, err := boost.NewAppConfig(
		"MyApp",
		"example.conf",
    		// enabled debug logging
		true,
		types.NewString("name", "seth"),
	)

	defer conf.Cleanup()
	if err != nil {
		panic(err)
	}

	config := &Configuration{}
	err = conf.ParseFunction("configure", config)
	if err != nil {
		panic(err)
	}

	fmt.Println(config)
}

API Coverage

At the moment all Lua stdlib packages appear to be fully functional (os, io, file, math etc..) as well as a few Gopher-Lua modules for serialization, http and utility. Native/Pure Lua libraries and C-Wrapping modules are yet to be tested. Most pure Lua code should work, anything interfacing with C should not be expected to work.

Included Gopher-Lua Modules:

  • http (http client wrapping net/http)
  • re (regex)
  • json
  • yaml
  • xmlpath
  • url (parser)
  • lfs (Lua Filesystem, not complete)

Shout-outs

Special Thanks to the creator of https://github.com/yuin/gopher-lua which this library is almost fully dependent on.

Contribution and maintenance

While Boost has been tested in small apps, be careful when using this library for anything in sensitive environments. If you would like to make a suggestion or report a bug, please feel free to submit a PR or issue. I really hope you enjoy using Boost! Thanks!

boost's People

Contributors

cosmotek avatar

Stargazers

venjiang avatar

Watchers

James Cloos avatar

Forkers

happy-ferret

boost's Issues

Create another example!

I would like to have some more examples that show off boost and what it can do... something creative that makes http requests from the config or generates the config in Lua in some way would be really cool!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.