示例#1
0
func readConfig() error {

	viper.SetConfigType("yaml")
	viper.SetDefault("proxyList", "/etc/proxy.list")
	viper.SetDefault("check", map[string]interface{}{
		"url":      "http://ya.ru",
		"string":   "yandex",
		"interval": "60m",
		"timeout":  "5s",
	})
	viper.SetDefault("bind", "0.0.0.0:8080")
	viper.SetDefault("workersCount", 20)
	viper.SetDefault("maxTry", 3)
	viper.SetDefault("debug", false)

	var configFile = flag.StringP("config", "c", "/etc/"+appName+".yaml",
		"full path to config")
	var showVersion = flag.BoolP("version", "v", false, "version")
	flag.Parse()

	if *showVersion {
		log.Println(appVersion)
		os.Exit(0)
	}

	file, err := ioutil.ReadFile(*configFile)
	if err != nil {
		return err
	}

	err = viper.ReadConfig(bytes.NewReader(file))
	if err != nil {
		return err
	}

	err = viper.Unmarshal(&cfg)
	if err != nil {
		return err
	}
	return nil
}
示例#2
0
文件: drive.go 项目: Blackfin/rclone
// Constants
const (
	rcloneClientID     = "202264815644.apps.googleusercontent.com"
	rcloneClientSecret = "8p/yms3OlNXE9OTDl/HLypf9gdiJ5cT3"
	driveFolderType    = "application/vnd.google-apps.folder"
	timeFormatIn       = time.RFC3339
	timeFormatOut      = "2006-01-02T15:04:05.000000000Z07:00"
	minSleep           = 10 * time.Millisecond
	maxSleep           = 2 * time.Second
	decayConstant      = 2 // bigger for slower decay, exponential
)

// Globals
var (
	// Flags
	driveFullList = pflag.BoolP("drive-full-list", "", true, "Use a full listing for directory list. More data but usually quicker.")
	driveUseTrash = pflag.BoolP("drive-use-trash", "", false, "Send files to the trash instead of deleting permanently.")
	// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
	// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
	chunkSize         = fs.SizeSuffix(256 * 1024)
	driveUploadCutoff = chunkSize
	// Description of how to auth for this app
	driveConfig = &oauth2.Config{
		Scopes:       []string{"https://www.googleapis.com/auth/drive"},
		Endpoint:     google.Endpoint,
		ClientID:     rcloneClientID,
		ClientSecret: fs.Reveal(rcloneClientSecret),
		RedirectURL:  oauthutil.TitleBarRedirectURL,
	}
)
示例#3
0
import (
	"fmt"
	"io"
	"os"
	"runtime"

	kruntime "k8s.io/kubernetes/pkg/runtime"

	"github.com/golang/glog"
	flag "github.com/spf13/pflag"
)

var (
	functionDest = flag.StringP("func-dest", "f", "-", "Output for swagger functions; '-' means stdout (default)")
	typeSrc      = flag.StringP("type-src", "s", "", "From where we are going to read the types")
	verify       = flag.BoolP("verify", "v", false, "Verifies if the given type-src file has documentation for every type")
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	flag.Parse()

	if *typeSrc == "" {
		glog.Fatalf("Please define -s flag as it is the source file")
	}

	var funcOut io.Writer
	if *functionDest == "-" {
		funcOut = os.Stdout
	} else {
		file, err := os.Create(*functionDest)
示例#4
0
文件: main.go 项目: ysh7/kubernetes
import (
	"fmt"
	"path/filepath"

	"k8s.io/kubernetes/cmd/libs/go2idl/args"
	clientgenargs "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/args"
	"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators"
	"k8s.io/kubernetes/pkg/api/unversioned"

	"github.com/golang/glog"
	flag "github.com/spf13/pflag"
)

var (
	test          = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata")
	inputVersions = flag.StringSlice("input", []string{"api/", "extensions/"}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions\"")
	clientsetName = flag.StringP("clientset-name", "n", "internalclientset", "the name of the generated clientset package.")
	clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"")
	clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients")
	fakeClient    = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests")
)

func versionToPath(group string, version string) (path string) {
	const base = "k8s.io/kubernetes/pkg"
	// special case for the core group
	if group == "api" {
		path = filepath.Join(base, "api", version)
	} else {
		path = filepath.Join(base, "apis", group, version)
	}
示例#5
0
package cli

import (
	"fmt"
	"os"

	"github.com/pilebones/backdoorGolang/core/common"
	"github.com/pilebones/backdoorGolang/core/socket"
	"github.com/spf13/pflag"
)

var (
	host          = pflag.StringP("host", "h", "localhost", "Set hostname to use")
	port          = pflag.IntP("port", "p", 9876, "Set port number to use")
	isListenMode  = pflag.BoolP("listen", "l", false, "Enable listen mode (server socket mode)")
	isVerboseMode = pflag.BoolP("verbose", "v", false, "Enable mode verbose")
	isDebugMode   = pflag.BoolP("debug", "d", false, "Enable mode debug")
	isVersionMode = pflag.BoolP("version", "V", false, "Display version number")
)

/** Print data when debug mode is enabled */
func DisplayAsDebug(message string) {
	if UseDebugMode() {
		fmt.Println(message)
	}
}

/** Return true if mode use from parameter */
func UseMode(mode *bool) bool {
	if *mode {
		return true
示例#6
0
文件: config.go 项目: Blackfin/rclone
)

type SizeSuffix int64

// Global
var (
	// Config file
	ConfigFile *goconfig.ConfigFile
	// Home directory
	HomeDir = configHome()
	// Config file path
	ConfigPath = path.Join(HomeDir, configFileName)
	// Global config
	Config = &ConfigInfo{}
	// Flags
	verbose        = pflag.BoolP("verbose", "v", false, "Print lots more stuff")
	quiet          = pflag.BoolP("quiet", "q", false, "Print as little stuff as possible")
	modifyWindow   = pflag.DurationP("modify-window", "", time.Nanosecond, "Max time diff to be considered the same")
	checkers       = pflag.IntP("checkers", "", 8, "Number of checkers to run in parallel.")
	transfers      = pflag.IntP("transfers", "", 4, "Number of file transfers to run in parallel.")
	configFile     = pflag.StringP("config", "", ConfigPath, "Config file.")
	checkSum       = pflag.BoolP("checksum", "c", false, "Skip based on checksum & size, not mod-time & size")
	sizeOnly       = pflag.BoolP("size-only", "", false, "Skip based on size only, not mod-time or checksum")
	dryRun         = pflag.BoolP("dry-run", "n", false, "Do a trial run with no permanent changes")
	connectTimeout = pflag.DurationP("contimeout", "", 60*time.Second, "Connect timeout")
	timeout        = pflag.DurationP("timeout", "", 5*60*time.Second, "IO idle timeout")
	dumpHeaders    = pflag.BoolP("dump-headers", "", false, "Dump HTTP headers - may contain sensitive info")
	dumpBodies     = pflag.BoolP("dump-bodies", "", false, "Dump HTTP headers and bodies - may contain sensitive info")
	bwLimit        SizeSuffix
)
示例#7
0
// SizeSuffix is parsed by flag with k/M/G suffixes
type SizeSuffix int64

// Global
var (
	// ConfigFile is the config file data structure
	ConfigFile *goconfig.ConfigFile
	// HomeDir is the home directory of the user
	HomeDir = configHome()
	// ConfigPath points to the config file
	ConfigPath = path.Join(HomeDir, configFileName)
	// Config is the global config
	Config = &ConfigInfo{}
	// Flags
	verbose         = pflag.BoolP("verbose", "v", false, "Print lots more stuff")
	quiet           = pflag.BoolP("quiet", "q", false, "Print as little stuff as possible")
	modifyWindow    = pflag.DurationP("modify-window", "", time.Nanosecond, "Max time diff to be considered the same")
	checkers        = pflag.IntP("checkers", "", 8, "Number of checkers to run in parallel.")
	transfers       = pflag.IntP("transfers", "", 4, "Number of file transfers to run in parallel.")
	configFile      = pflag.StringP("config", "", ConfigPath, "Config file.")
	checkSum        = pflag.BoolP("checksum", "c", false, "Skip based on checksum & size, not mod-time & size")
	sizeOnly        = pflag.BoolP("size-only", "", false, "Skip based on size only, not mod-time or checksum")
	ignoreTimes     = pflag.BoolP("ignore-times", "I", false, "Don't skip files that match size and time - transfer all files")
	ignoreExisting  = pflag.BoolP("ignore-existing", "", false, "Skip all files that exist on destination")
	dryRun          = pflag.BoolP("dry-run", "n", false, "Do a trial run with no permanent changes")
	connectTimeout  = pflag.DurationP("contimeout", "", 60*time.Second, "Connect timeout")
	timeout         = pflag.DurationP("timeout", "", 5*60*time.Second, "IO idle timeout")
	dumpHeaders     = pflag.BoolP("dump-headers", "", false, "Dump HTTP headers - may contain sensitive info")
	dumpBodies      = pflag.BoolP("dump-bodies", "", false, "Dump HTTP headers and bodies - may contain sensitive info")
	skipVerify      = pflag.BoolP("no-check-certificate", "", false, "Do not verify the server SSL certificate. Insecure.")
	"github.com/adobe-apiplatform/api-gateway-config-supervisor/sync"
	"github.com/adobe-apiplatform/api-gateway-config-supervisor/ws"
	_ "net/http/pprof"

	"github.com/carlescere/scheduler"

	"github.com/spf13/pflag"

	"github.com/koyachi/go-term-ansicolor/ansicolor"
)

var (
	// Flags
	cpuprofile   = pflag.StringP("cpuprofile", "", "", "Write cpu profile to file")
	version      = pflag.BoolP("version", "V", false, "Print the version number")
	syncInterval = pflag.DurationP("sync-interval", "", time.Second*5, "Time interval for the next sync")
	syncCmd      = pflag.StringP("sync-cmd", "", "echo sync-cmd not defined", "Command used to syncing")
	syncFolder   = pflag.StringP("sync-folder", "", "~/tmp/api-gateway-config", "The folder to watch for changes.")
	reloadCmd    = pflag.StringP("reload-cmd", "", "echo reload-cmd not defined", "Command used to reload the gateway")
	httpAddr     = pflag.StringP("http-addr", "", "127.0.0.1:8888", "Http Address exposing a /health-check for the sync process")
	debug        = pflag.BoolP("debug", "v", false, "Print extra debug information")
	status       = sync.GetStatusInstance()
)

func syntaxError() {
	fmt.Fprintf(os.Stderr, `Execute a sync command and watch a folder for changes.`)
}

// ParseFlags parses the command line flags
func ParseFlags() {
示例#9
0
文件: filter.go 项目: kpabba/rclone
import (
	"bufio"
	"fmt"
	"os"
	"regexp"
	"strconv"
	"strings"
	"time"

	"github.com/spf13/pflag"
)

// Global
var (
	// Flags
	deleteExcluded = pflag.BoolP("delete-excluded", "", false, "Delete files on dest excluded from sync")
	filterRule     = pflag.StringP("filter", "f", "", "Add a file-filtering rule")
	filterFrom     = pflag.StringP("filter-from", "", "", "Read filtering patterns from a file")
	excludeRule    = pflag.StringP("exclude", "", "", "Exclude files matching pattern")
	excludeFrom    = pflag.StringP("exclude-from", "", "", "Read exclude patterns from file")
	includeRule    = pflag.StringP("include", "", "", "Include files matching pattern")
	includeFrom    = pflag.StringP("include-from", "", "", "Read include patterns from file")
	filesFrom      = pflag.StringP("files-from", "", "", "Read list of source-file names from file")
	minAge         = pflag.StringP("min-age", "", "", "Don't transfer any file younger than this in s or suffix ms|s|m|h|d|w|M|y")
	maxAge         = pflag.StringP("max-age", "", "", "Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y")
	minSize        SizeSuffix
	maxSize        SizeSuffix
	dumpFilters    = pflag.BoolP("dump-filters", "", false, "Dump the filters to the output")
	//cvsExclude     = pflag.BoolP("cvs-exclude", "C", false, "Exclude files in the same way CVS does")
)
示例#10
0
	rcloneClientID              = "202264815644.apps.googleusercontent.com"
	rcloneEncryptedClientSecret = "8p/yms3OlNXE9OTDl/HLypf9gdiJ5cT3"
	driveFolderType             = "application/vnd.google-apps.folder"
	timeFormatIn                = time.RFC3339
	timeFormatOut               = "2006-01-02T15:04:05.000000000Z07:00"
	minSleep                    = 10 * time.Millisecond
	maxSleep                    = 2000 * time.Millisecond
	decayConstant               = 0 // bigger for slower decay, exponential
	attackConstant              = 0 // bigger for slower attack, exponential
	defaultExtensions           = "docx,xlsx,pptx,svg"
)

// Globals
var (
	// Flags
	driveFullList      = pflag.BoolP("drive-full-list", "", false, "Use a full listing for directory list. More data but usually quicker. (obsolete)")
	driveAuthOwnerOnly = pflag.BoolP("drive-auth-owner-only", "", false, "Only consider files owned by the authenticated user. Requires drive-full-list.")
	driveUseTrash      = pflag.BoolP("drive-use-trash", "", false, "Send files to the trash instead of deleting permanently.")
	driveExtensions    = pflag.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.")
	// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
	// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
	chunkSize         = fs.SizeSuffix(8 * 1024 * 1024)
	driveUploadCutoff = chunkSize
	// Description of how to auth for this app
	driveConfig = &oauth2.Config{
		Scopes:       []string{"https://www.googleapis.com/auth/drive"},
		Endpoint:     google.Endpoint,
		ClientID:     rcloneClientID,
		ClientSecret: fs.Reveal(rcloneEncryptedClientSecret),
		RedirectURL:  oauthutil.TitleBarRedirectURL,
	}
示例#11
0
文件: config.go 项目: X1011/rclone
)

type SizeSuffix int64

// Global
var (
	// Config file
	ConfigFile *goconfig.ConfigFile
	// Home directory
	HomeDir = configHome()
	// Config file path
	ConfigPath = path.Join(HomeDir, configFileName)
	// Global config
	Config = &ConfigInfo{}
	// Flags
	verbose        = pflag.BoolP("verbose", "v", false, "Print lots more stuff")
	quiet          = pflag.BoolP("quiet", "q", false, "Print as little stuff as possible")
	modifyWindow   = pflag.DurationP("modify-window", "", time.Nanosecond, "Max time diff to be considered the same")
	checkers       = pflag.IntP("checkers", "", 8, "Number of checkers to run in parallel.")
	transfers      = pflag.IntP("transfers", "", 4, "Number of file transfers to run in parallel.")
	configFile     = pflag.StringP("config", "", ConfigPath, "Config file.")
	checkSum       = pflag.BoolP("checksum", "c", false, "Skip based on checksum & size, not mod-time & size")
	sizeOnly       = pflag.BoolP("size-only", "", false, "Skip based on size only, not mod-time or checksum")
	dryRun         = pflag.BoolP("dry-run", "n", false, "Do a trial run with no permanent changes")
	connectTimeout = pflag.DurationP("contimeout", "", 60*time.Second, "Connect timeout")
	timeout        = pflag.DurationP("timeout", "", 5*60*time.Second, "IO idle timeout")
	bwLimit        SizeSuffix
)

func init() {
	pflag.VarP(&bwLimit, "bwlimit", "", "Bandwidth limit in kBytes/s, or use suffix k|M|G")
示例#12
0
import (
	"fmt"
	"github.com/micahhausler/rabbit-herder/herd"
	flag "github.com/spf13/pflag"
	"os"
	"strings"
)

// The binary version
const Version = "0.0.1"

var apiPtr = flag.StringP("api", "a", "http://localhost:15672", "The rabbitmq API to connect to.")
var userPtr = flag.StringP("user", "u", "guest", "The user account for the API")
var passwordPtr = flag.StringP("password", "p", "guest", "The password for the API")
var dryRunP = flag.BoolP("dry-run", "d", false, "Print commands, but don't run them")
var version = flag.BoolP("version", "v", false, "Print version and exit")

func main() {
	flag.Parse()
	if *version {
		fmt.Printf("rabbit-herder %s\n", Version)
		os.Exit(0)
	}

	apiHosts := herd.GetApiHosts(*apiPtr, *userPtr, *passwordPtr)
	if len(apiHosts) > 1 {
		fmt.Printf(
			"API responded len(%d) with hosts: %s\n",
			len(apiHosts),
			strings.Trim(fmt.Sprint(apiHosts), "[]"),
示例#13
0
文件: flags.go 项目: ncw/rclone
// BoolP defines a flag which can be overridden by an environment variable
//
// It is a thin wrapper around pflag.BoolP
func BoolP(name, shorthand string, value bool, usage string) (out *bool) {
	out = pflag.BoolP(name, shorthand, value, usage)
	setDefaultFromEnv(name)
	return out
}
示例#14
0
文件: rclone.go 项目: JoeyGo23/rclone
	// Active file systems
	_ "github.com/ncw/rclone/amazonclouddrive"
	_ "github.com/ncw/rclone/drive"
	_ "github.com/ncw/rclone/dropbox"
	_ "github.com/ncw/rclone/googlecloudstorage"
	_ "github.com/ncw/rclone/local"
	_ "github.com/ncw/rclone/s3"
	_ "github.com/ncw/rclone/swift"
)

// Globals
var (
	// Flags
	cpuprofile    = pflag.StringP("cpuprofile", "", "", "Write cpu profile to file")
	statsInterval = pflag.DurationP("stats", "", time.Minute*1, "Interval to print stats (0 to disable)")
	version       = pflag.BoolP("version", "V", false, "Print the version number")
	logFile       = pflag.StringP("log-file", "", "", "Log everything to this file")
	retries       = pflag.IntP("retries", "", 3, "Retry operations this many times if they fail")
)

// Command holds info about the current running command
type Command struct {
	Name     string
	Help     string
	ArgsHelp string
	Run      func(fdst, fsrc fs.Fs) error
	MinArgs  int
	MaxArgs  int
	NoStats  bool
	Retry    bool
}
示例#15
0
文件: b2.go 项目: pombredanne/rclone
	testModeHeader   = "X-Bz-Test-Mode"
	retryAfterHeader = "Retry-After"
	minSleep         = 10 * time.Millisecond
	maxSleep         = 2 * time.Second
	decayConstant    = 1 // bigger for slower decay, exponential
	maxParts         = 10000
	maxVersions      = 100 // maximum number of versions we search in --b2-versions mode
)

// Globals
var (
	minChunkSize       = fs.SizeSuffix(100E6)
	chunkSize          = fs.SizeSuffix(96 * 1024 * 1024)
	uploadCutoff       = fs.SizeSuffix(200E6)
	b2TestMode         = pflag.StringP("b2-test-mode", "", "", "A flag string for X-Bz-Test-Mode header.")
	b2Versions         = pflag.BoolP("b2-versions", "", false, "Include old versions in directory listings.")
	errNotWithVersions = errors.New("can't modify or delete files in --b2-versions mode")
)

// Register with Fs
func init() {
	fs.Register(&fs.RegInfo{
		Name:        "b2",
		Description: "Backblaze B2",
		NewFs:       NewFs,
		Options: []fs.Option{{
			Name: "account",
			Help: "Account ID",
		}, {
			Name: "key",
			Help: "Application Key",
示例#16
0
// SizeSuffix is parsed by flag with k/M/G suffixes
type SizeSuffix int64

// Global
var (
	// ConfigFile is the config file data structure
	ConfigFile *goconfig.ConfigFile
	// HomeDir is the home directory of the user
	HomeDir = configHome()
	// ConfigPath points to the config file
	ConfigPath = path.Join(HomeDir, configFileName)
	// Config is the global config
	Config = &ConfigInfo{}
	// Flags
	verbose        = pflag.BoolP("verbose", "v", false, "Print lots more stuff")
	quiet          = pflag.BoolP("quiet", "q", false, "Print as little stuff as possible")
	modifyWindow   = pflag.DurationP("modify-window", "", time.Nanosecond, "Max time diff to be considered the same")
	checkers       = pflag.IntP("checkers", "", 8, "Number of checkers to run in parallel.")
	transfers      = pflag.IntP("transfers", "", 4, "Number of file transfers to run in parallel.")
	configFile     = pflag.StringP("config", "", ConfigPath, "Config file.")
	checkSum       = pflag.BoolP("checksum", "c", false, "Skip based on checksum & size, not mod-time & size")
	sizeOnly       = pflag.BoolP("size-only", "", false, "Skip based on size only, not mod-time or checksum")
	ignoreExisting = pflag.BoolP("ignore-existing", "", false, "Skip all files that exist on destination")
	dryRun         = pflag.BoolP("dry-run", "n", false, "Do a trial run with no permanent changes")
	connectTimeout = pflag.DurationP("contimeout", "", 60*time.Second, "Connect timeout")
	timeout        = pflag.DurationP("timeout", "", 5*60*time.Second, "IO idle timeout")
	dumpHeaders    = pflag.BoolP("dump-headers", "", false, "Dump HTTP headers - may contain sensitive info")
	dumpBodies     = pflag.BoolP("dump-bodies", "", false, "Dump HTTP headers and bodies - may contain sensitive info")
	skipVerify     = pflag.BoolP("no-check-certificate", "", false, "Do not verify the server SSL certificate. Insecure.")
	deleteBefore   = pflag.BoolP("delete-before", "", false, "When synchronizing, delete files on destination before transfering")
示例#17
0
func main() {

	conf = viper.New()

	conf.SetEnvPrefix("FIFO2KINESIS")

	conf.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
	conf.AutomaticEnv()

	viper.SetConfigName("fifo2kinesis")

	pflag.IntP("buffer-queue-limit", "l", 500, "The maximum number of items in the buffer before it is flushed")
	conf.BindPFlag("buffer-queue-limit", pflag.Lookup("buffer-queue-limit"))
	conf.SetDefault("buffer-queue-limit", 500)

	pflag.BoolP("debug", "d", false, "Show debug level log messages")
	conf.BindPFlag("debug", pflag.Lookup("debug"))
	conf.SetDefault("debug", "")

	pflag.StringP("failed-attempts-dir", "D", "", "The path to the directory containing failed attempts")
	conf.BindPFlag("failed-attempts-dir", pflag.Lookup("failed-attempts-dir"))
	conf.SetDefault("failed-attempts-dir", "")

	pflag.StringP("fifo-name", "f", "", "The absolute path of the named pipe, e.g. /var/test.pipe")
	conf.BindPFlag("fifo-name", pflag.Lookup("fifo-name"))
	conf.SetDefault("fifo-name", "")

	pflag.StringP("flush-handler", "h", "kinesis", "Defaults to \"kinesis\", use \"logger\" for debugging")
	conf.BindPFlag("flush-handler", pflag.Lookup("flush-handler"))
	conf.SetDefault("flush-handler", "kinesis")

	pflag.IntP("flush-interval", "i", 5, "The number of seconds before the buffer is flushed and written to Kinesis")
	conf.BindPFlag("flush-interval", pflag.Lookup("flush-interval"))
	conf.SetDefault("flush-interval", 5)

	pflag.StringP("partition-key", "p", "", "The partition key, defaults to a 12 character random string if omitted")
	conf.BindPFlag("partition-key", pflag.Lookup("partition-key"))
	conf.SetDefault("partition-key", "")

	pflag.StringP("region", "R", "", "The AWS region that the Kinesis stream is provisioned in")
	conf.BindPFlag("region", pflag.Lookup("region"))
	conf.SetDefault("region", "")

	pflag.StringP("role-arn", "r", "", "The ARN of the AWS role being assumed.")
	conf.BindPFlag("role-arn", pflag.Lookup("role-arn"))
	conf.SetDefault("role-arn", "")

	pflag.StringP("role-session-name", "S", "", "The session name used when assuming a role.")
	conf.BindPFlag("role-session-name", pflag.Lookup("role-session-name"))
	conf.SetDefault("role-session-name", "")

	pflag.StringP("stream-name", "s", "", "The name of the Kinesis stream")
	conf.BindPFlag("stream-name", pflag.Lookup("stream-name"))
	conf.SetDefault("stream-name", "")

	pflag.Parse()

	if conf.GetBool("debug") {
		logger = NewLogger(LOG_DEBUG)
	} else {
		logger = NewLogger(LOG_INFO)
	}

	logger.Debug("configuration parsed")

	h := conf.GetString("flush-handler")
	if h != "kinesis" && h != "logger" {
		logger.Fatalf("flush handler not valid: %s", h)
	}

	fn := conf.GetString("fifo-name")
	if fn == "" {
		logger.Fatal("missing required option: fifo-name")
	}

	sn := conf.GetString("stream-name")
	if h == "kinesis" && sn == "" {
		logger.Fatal("missing required option: stream-name")
	}

	ql := conf.GetInt("buffer-queue-limit")
	if ql < 1 {
		logger.Fatal("buffer queue limit must be greater than 0")
	} else if h == "kinesis" && ql > 500 {
		logger.Fatal("buffer queue cannot exceed 500 items when using the kinesis handler")
	}

	fifo := &Fifo{fn}

	bw := &MemoryBufferWriter{
		Fifo:          fifo,
		FlushInterval: conf.GetInt("flush-interval"),
		QueueLimit:    ql,
	}

	var bf BufferFlusher
	if h == "kinesis" {
		pk := conf.GetString("partition-key")
		bf = NewKinesisBufferFlusher(sn, pk)
	} else {
		bf = &LoggerBufferFlusher{}
	}

	var fh FailedAttemptHandler
	dir := conf.GetString("failed-attempts-dir")
	if dir == "" {
		fh = &NullFailedAttemptHandler{}
	} else {
		stat, err := os.Stat(dir)
		if os.IsNotExist(err) {
			logger.Fatal("failed attempts directory does not exist")
		} else if !stat.IsDir() {
			logger.Fatal("failed attempts directory is not a directory")
		} else if unix.Access(dir, unix.R_OK) != nil {
			logger.Fatal("failed attempts directory is not readable")
		} else {
			fh = &FileFailedAttemptHandler{dir, fifo}
		}
	}

	shutdown := EventListener()
	RunPipeline(fifo, &Buffer{bw, bf, fh}, shutdown)
}