whitelist

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

README

Whitelist Plugin

The whitelist plugin is a plugin for micro which whitelists the services that can be used via the /rpc HTTP endpoint.

Usage

Register the plugin before building Micro

package main

import (
	"github.com/micro/micro/plugin"
	"github.com/micro/go-plugins/micro/whitelist"
)

func init() {
	plugin.Register(whitelist.NewRPCWhitelist())
}

It can then be applied on the command line like so.

micro --rpc_whitelist go.micro.srv.greeter,go.micro.srv.example api
Scoped to API

If you like to only apply the plugin for a specific component you can register it with that specifically. For example, below you'll see the plugin registered with the API.

package main

import (
	"github.com/micro/micro/api"
	"github.com/micro/go-plugins/micro/whitelist"
)

func init() {
	api.Register(whitelist.NewRPCWhitelist())
}

Here's what the help displays when you do that.

$ go run main.go link.go api --help
NAME:
   main api - Run the micro API

USAGE:
   main api [command options] [arguments...]

OPTIONS:
   --rpc_whitelist 	Comma separated whitelist of allowed services for RPC calls [$MICRO_RPC_WHITELIST]

In this case the usage would be

micro api --rpc_whitelist go.micro.srv.greeter

Documentation

Overview

Package whitelist is a micro plugin for whitelisting service requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPCWhitelist

func NewRPCWhitelist(services ...string) plugin.Plugin

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL