Skip to content

FrauleinGela/laika

 
 

Repository files navigation

Laika

CircleCI Coverage Status

Maintainer: Diego

Laika is a feature flag/feature toggle service, written in Go, that allows the creation of flags and their activation/deactivation for specific environments. This way it is possible to control in which environments each feature is available. For instance, when a new feature is developed and released, it would make sense if it was only made available, at first, in a testing or Q&A environment, and only later in production. With Laika this can be achieved by simply going to a web page, selecting the feature, and changing its status on the desired environments.

Using Laika in a project thus allows for fast and continuous feature release and deployment.

laika-php is a PHP library that handles communication with Laika's API. You can get it here.

API Reference

Method Endpoint Description
GET /api/health Check the service health
GET /api/features List all features
GET /api/features/:name Get a feature by name
POST /api/features Create a feature
PATCH /api/features/:name Update a feature
GET /api/environments List all environments
GET /api/environments/:name Get an environment by name
POST /api/environments Create an environment
PATCH /api/environments/:name Update an environment
GET /api/users/:username Get a user by username
POST /api/users Create a user

Client

Laika contains a polling HTTP client that allows to easily check for enabled/disabled features on Go code. It can be found in the client package. While Laika uses the vendor directory to store external dependencies, client can be imported without any vendoring.

Install

$ go get -u github.com/MEDIGO/laika/client

Usage

package main

import (
	"log"

	"github.com/MEDIGO/laika/client"
)

func main() {
	c, err := client.NewClient(client.Config{
		Addr:        "127.0.0.1:8000",
		Username:    "my-username",
		Password:    "my-password",
		Environment: "prod",
	})

	if err != nil {
		log.Fatal(err)
	}

	if c.IsEnabled("my-awesome-feature", false) {
		log.Print("IT'S ALIVE!")
	} else {
		log.Print("Move along. Nothing to see here.")
	}
}

Developing

To develop Laika you need to have the following tools installed in your machine:

Then install all the Go and Javascript dependencies with:

$ make install

Migrate the database with:

$ make migrate

Build continuously the server and UI with:

$ make watch

And start hacking!

$ open http://localhost:8000

Testing

The whole test suite can be executed with:

$ make test

Some test require a MySQL instance, you can pass the configuration to them with the following environment variables:

LAIKA_TEST_MYSQL_HOST=localhost
LAIKA_TEST_MYSQL_PORT=3306
LAIKA_TEST_MYSQL_USERNAME=root
LAIKA_TEST_MYSQL_PASSWORD=root
LAIKA_TEST_MYSQL_DBNAME=test

Current state of the project

In the current release of Laika, it is possible to create feature flags and enable/disable them in the existing environments.

Wishlist

  • Specify country access (e.g. feature only enabled in Germany).
  • Specify user access with percentage (e.g. feature only enabled for 30% of the user base).
  • Have a field for environment creation on the web page.
  • History for flag status changes.

Copyright and license

Copyright © 2016 MEDIGO GmbH.

Laika is licensed under the MIT License. See LICENSE for the full license text.

About

A feature flag service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 66.8%
  • TypeScript 14.5%
  • HTML 8.5%
  • JavaScript 3.2%
  • Shell 3.1%
  • CSS 2.5%
  • Makefile 1.4%