stats_auth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

stats_auth Plugin

stats_auth plugin enables basic auth on the /stats endpoint

Usage

Register the plugin before building Micro

package main

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

func init() {
	plugin.Register(stats_auth.New())
}

You can then set the appropriate variables through command line like so:

micro --enable_stats --stats_auth_user=root --stats_auth_pass=admin --stats_auth_realm=A\ realm\ of\ fun\ and\ happiness 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/stats_auth"
)

func init() {
	api.Register(stats_auth.New())
}

Here's the help output:

	 --stats_auth_user 								Username used for basic auth for /stats endpoint [$STATS_AUTH_USER]
   --stats_auth_pass 								Password used for basic auth for /stats endpoint [$STATS_AUTH_PASS]
   --stats_auth_realm 							Realm used for basic auth for /stats endpoint. Escape spaces to add multiple words. Optional. Defaults to Access to stats is restricted [$STATS_AUTH_REALM]

In this case the usage would be

micro --enable_stats api --stats_auth_user=root --stats_auth_pass=admin --stats_auth_realm=A\ realm\ of\ fun\ and\ happiness

Documentation

Overview

stats_auth enables basic auth on the /stats endpoint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() 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