config

package module
v2.16.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 10 Imported by: 1

README

PHP Client

Roadrunner Worker

Configuration

This plugin parse other's plugins configuration and uses flags to find the YAML config.

Flags

  1. -c [PATH]: points RR to the configuration location.

Minimal dependencies:

This plugin is independent.

Worker sample:

<?php

require __DIR__ . '/vendor/autoload.php';

// Create a new Worker from global environment
$worker = \Spiral\RoadRunner\Worker::create();

while ($data = $worker->waitPayload()) {
    // Received Payload
    var_dump($data);

    // Respond Answer
    $worker->respond(new \Spiral\RoadRunner\Payload('DONE'));
}

Tips:

  1. By default, .rr.yaml used as the configuration, located in the same directory with RR binary.

Documentation

Index

Constants

View Source
const (
	PluginName string = "config"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Path      string
	Prefix    string
	Type      string
	ReadInCfg []byte
	// user defined Flags in the form of <option>.<key> = <value>
	// which overwrites initial config key
	Flags []string

	// Timeout ...
	Timeout time.Duration
	// RRVersion passed from the Endure.
	Version string
	// contains filtered or unexported fields
}

func (*Plugin) Get

func (p *Plugin) Get(name string) interface{}

Get raw config in a form of config section.

func (*Plugin) GracefulTimeout

func (p *Plugin) GracefulTimeout() time.Duration

func (*Plugin) Has

func (p *Plugin) Has(name string) bool

Has checks if config section exists.

func (*Plugin) Init

func (p *Plugin) Init() error

Init config provider.

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns user-friendly plugin name

func (*Plugin) Overwrite

func (p *Plugin) Overwrite(values map[string]interface{}) error

Overwrite overwrites existing config with provided values

func (*Plugin) RRVersion

func (p *Plugin) RRVersion() string

RRVersion returns current RR version

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop() error

func (*Plugin) Unmarshal

func (p *Plugin) Unmarshal(out interface{}) error

func (*Plugin) UnmarshalKey

func (p *Plugin) UnmarshalKey(name string, out interface{}) error

UnmarshalKey reads configuration section into configuration object.

Directories

Path Synopsis
configs

Jump to

Keyboard shortcuts

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