servicecontext

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const ContextEnvName = "RHOAS_CONTEXT"

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() (string, error)

DefaultDir returns the default parent directory of the context file

func HasCustomLocation

func HasCustomLocation() bool

Checks if context has custom location

Types

type Context

type Context struct {
	Contexts       map[string]ServiceConfig `json:"contexts,omitempty"`
	CurrentContext string                   `json:"current_context"`
}

Context is a type which describes the properties of context file

type File

type File struct{}

File is a type which describes a context file

func (*File) Load

func (c *File) Load() (*Context, error)

Load loads the profiles from the context file. If the context file doesn't exist it will return an empty context object.

func (*File) Location

func (c *File) Location() (path string, err error)

Location gets the path to the context file

func (*File) Remove

func (c *File) Remove() error

Remove removes the context file.

func (*File) Save

func (c *File) Save(cfg *Context) error

Save saves the given profiles to the context file.

type IContext

type IContext interface {
	Load() (*Context, error)
	Save(*Context) error
	Remove() error
	Location() (string, error)
}

IContext is an interface which describes functions for context file

func NewFile

func NewFile() IContext

NewFile creates a new context type

type ServiceConfig

type ServiceConfig struct {
	KafkaID           string `json:"kafkaID"`
	ServiceRegistryID string `json:"serviceregistryID"`
}

ServiceConfig is a map of identifiers for the application services

Jump to

Keyboard shortcuts

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