core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitStores

func InitStores(stores []*Store) ([]wtypes.Store, error)

InitStores initialises the stores from a configuration.

Types

type Config

type Config struct {
	Stores []*Store          `json:"stores"`
	Rules  []*RuleDefinition `json:"rules"`
}

Config is the configuration for the daemon.

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new configuration. Configuration can come from the configuration file or environment variables.

type Rule

type Rule struct {
	// contains filtered or unexported fields
}

Rule contains a ready-to-run rule script.

func InitRules

func InitRules(defs []*RuleDefinition) ([]*Rule, error)

InitRules initialises the rules from a configuration.

func NewRule

func NewRule(def *RuleDefinition) (*Rule, error)

NewRule creates a new rule from its definition.

func (*Rule) Matches

func (r *Rule) Matches(request string, path string) bool

Matches returns true if this rule matches the path.

func (*Rule) Script

func (r *Rule) Script() string

Script returns the script for the rule.

type RuleDefinition

type RuleDefinition struct {
	Name    string `json:"name"`
	Request string `json:"request"`
	Account string `json:"account"`
	Script  string `json:"script"`
}

RuleDefinition defines a rule.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a server for GRPC.

func NewServer

func NewServer() (*Server, error)

NewServer creates a new GRPC server.

func (*Server) RegisterService

func (s *Server) RegisterService() error

RegisterService registers a GRPC service.

func (*Server) Serve

func (s *Server) Serve() error

Serve serves the GRPC server.

func (*Server) Server

func (s *Server) Server() *grpc.Server

Server returns the underlying GRPC server.

type Store

type Store struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Protected  bool   `json:"protected"`
	Passphrase string `json:"passphrase"`
}

Store defines a store within the configuration

Jump to

Keyboard shortcuts

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