server

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SelectedEnvironment []string

Currently selected environments

View Source
var SelectedWebEnvironment []string

Currently selected web environments

Functions

func ProxyLogin

func ProxyLogin(config *core.CoreConfig, authHost string, req *pb.LoginReq) (string, string, *pb.LoginResp, error)

ProxyLogin proxy logs in the user.

Types

type Env

type Env struct {
	ID        int        `json:"id"`
	Name      string     `json:"name"`
	Projects  []Project  `json:"projects"`
	Providers []Provider `json:"providers"`
}

Env represents an environment containing multiple services

type File

type File struct {
	EnvID  int     `json:"envID"`
	ProjID int     `json:"projID"`
	ServID int     `json:"servID"`
	ID     int     `json:"id"`
	Name   string  `json:"name"`
	Values []Value `json:"values"`
}

File represents an individual file containing template values

type Project

type Project struct {
	EnvID    int       `json:"envID"`
	ID       int       `json:"id"`
	Name     string    `json:"name"`
	Services []Service `json:"files"`
}

Project represents a project that contains multiple files

type Provider

type Provider struct {
	EnvID    int
	ID       int
	Name     string
	Sessions []map[string]interface{}
}

Provider represents a login session provider

type Server

type Server struct {
	VaultToken        string
	VaultAddr         string
	TrcAPITokenSecret []byte
	GQLSchema         gql.Schema
	Log               *log.Logger
}

Server implements the twirp api server endpoints

func NewServer

func NewServer(VaultAddr string, VaultToken string) *Server

NewServer Creates a new server struct and initializes the GraphQL schema

func (*Server) APILogin

func (s *Server) APILogin(ctx context.Context, req *pb.LoginReq) (*pb.LoginResp, error)

APILogin Verifies the user's login with the cubbyhole

func (*Server) CheckConnection

func (s *Server) CheckConnection(ctx context.Context, req *pb.NoParams) (*pb.CheckConnResp, error)

CheckConnection checks the server connection

func (*Server) Environments

func (s *Server) Environments(ctx context.Context, req *pb.NoParams) (*pb.EnvResp, error)

Environments selects environments based on dev or production mode

func (*Server) GetConfig

func (s *Server) GetConfig(env string, path string) (map[string]interface{}, error)

GetConfig gets a configuration by env and path.

func (*Server) GetStatus

func (s *Server) GetStatus(ctx context.Context, req *pb.NoParams) (*pb.VaultStatus, error)

GetStatus requests version info and whether the vault has been initailized

func (*Server) GetTemplate

func (s *Server) GetTemplate(ctx context.Context, req *pb.TemplateReq) (*pb.TemplateResp, error)

GetTemplate makes a request to the vault for the template found in <project>/<service>/<file>/template-file Returns the template data in base64 and the template's extension. Returns any errors generated by vault

func (*Server) GetValues

func (s *Server) GetValues(ctx context.Context, req *pb.GetValuesReq) (*pb.ValuesRes, error)

GetValues gets values requested from the vault

func (*Server) GetVaultTokens

func (s *Server) GetVaultTokens(ctx context.Context, req *pb.TokensReq) (*pb.TokensResp, error)

GetVaultTokens takes app role credentials and attempts to fetch names tokens from the vault

func (*Server) GraphQL

func (s *Server) GraphQL(ctx context.Context, req *pb.GraphQLQuery) (*pb.GraphQLResp, error)

GraphQL Accepts a GraphQL query and creates a response

func (*Server) InitConfig

func (s *Server) InitConfig(config *core.CoreConfig, env string) error

InitConfig initializes configuration information for the server.

func (*Server) InitGQL

func (s *Server) InitGQL()

InitGQL Initializes the GQL schema

func (*Server) InitVault

func (s *Server) InitVault(ctx context.Context, req *pb.InitReq) (*pb.InitResp, error)

InitVault Takes init request and inits/seeds vault with contained file data

func (*Server) ListServiceTemplates

func (s *Server) ListServiceTemplates(ctx context.Context, req *pb.ListReq) (*pb.ListResp, error)

ListServiceTemplates lists the templates under the requested project

func (*Server) ResetServer

func (s *Server) ResetServer(ctx context.Context, req *pb.ResetReq) (*pb.NoParams, error)

ResetServer resets vault token.

func (*Server) RollTokens

func (s *Server) RollTokens(ctx context.Context, req *pb.NoParams) (*pb.NoParams, error)

RollTokens checks the validity of tokens in super-secrets/bamboo/tokens and rerolls them

func (*Server) Unseal

func (s *Server) Unseal(ctx context.Context, req *pb.UnsealReq) (*pb.UnsealResp, error)

Unseal passes the unseal key to the vault and tries to unseal the vault

func (*Server) UpdateAPI

func (s *Server) UpdateAPI(ctx context.Context, req *pb.UpdateAPIReq) (*pb.NoParams, error)

UpdateAPI takes the passed URL and downloads the given build of the UI

func (*Server) Validate

func (s *Server) Validate(ctx context.Context, req *pb.ValidationReq) (*pb.ValidationResp, error)

Validate checks the vault to see if the requested credentials are validated

type Service

type Service struct {
	EnvID  int    `json:"envID"`
	ProjID int    `json:"projID"`
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Files  []File `json:"values"`
}

Service represents an service that contains multiple files

type Value

type Value struct {
	EnvID  int    `json:"envID"`
	ProjID int    `json:"projID"`
	ServID int    `json:"servID"`
	FileID int    `json:"fileID"`
	ID     int    `json:"id"`
	Key    string `json:"name"`
	Value  string `json:"value"`
	Source string `json:"source"`
}

Value represents an individual key-value pair with source

type VaultVals

type VaultVals struct {
	ID   string `json:"id"`
	Envs []Env  `json:"envs"`
}

VaultVals Holds environments, used for GraphQL

Jump to

Keyboard shortcuts

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