db

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataDirectory = "/var/lib/conter"
	DataFileName  = "app.db"
)

Variables

View Source
var (
	BucketProjects     = []byte("projects")
	BucketRoutes       = []byte("routes")
	BucketConfig       = []byte("config")
	BucketChallenges   = []byte("challenges")
	BucketCertificates = []byte("certificates")

	ErrItemNotFound = errors.New("item not found")
)
View Source
var (
	KeyAcmeEmail        = []byte("acme.email")
	KeyAcmePrivateKey   = []byte("acme.private_key")
	KeyAcmeRegistration = []byte("acme.registration")
)

Functions

This section is empty.

Types

type Client

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

Client acts as the interface between to communicate with our database system.

func NewClient

func NewClient() *Client

NewClient will create a new database client for handling operations.

func (*Client) Close

func (c *Client) Close() error

Close will cl

func (*Client) GetAllCertificates

func (c *Client) GetAllCertificates() map[string]*types.Certificate

GetAllCertificates will return all certificates with the key being the domain name.

func (*Client) GetAllProjects

func (c *Client) GetAllProjects() map[string][]types.Service

GetAllProjects will return a map of all projects known by the system in combination with their services.

func (*Client) GetCertificate

func (c *Client) GetCertificate(domain string) (*types.Certificate, error)

GetCertificate retrieves the certificate for the specified domain.

func (*Client) GetDomainChallenge

func (c *Client) GetDomainChallenge(domain string) *types.AcmeChallenge

GetDomainChallenge will return the latest known ACME challenge. If no challenge exists it will return nil.

func (*Client) GetIngressRoute

func (c *Client) GetIngressRoute(domain string) (*types.Ingress, error)

GetIngressRoute will return the ingress route if it exists.

func (*Client) GetIngressRoutesByProject

func (c *Client) GetIngressRoutesByProject(project string) []types.Ingress

GetIngressRoutesByProject returns all ingress routes related to the project.

func (*Client) GetServicesForProject

func (c *Client) GetServicesForProject(project string) []types.Service

GetServicesForProject will return the services associated for the project. If no services are available or the project does not exist it will return nil.

func (*Client) RemoveAcmeChallenge

func (c *Client) RemoveAcmeChallenge(domain string, token string, auth string) error

RemoveAcmeChallenge will remove the ACME challenge if all parameters match.

func (*Client) RemoveCertificate

func (c *Client) RemoveCertificate(domain string) error

RemoveCertificate removes the certificate from the bucket.

func (*Client) RemoveIngressRoute

func (c *Client) RemoveIngressRoute(domain string) error

func (*Client) RemoveProject

func (c *Client) RemoveProject(name string) error

RemoveProject will remove the project from the database.

func (*Client) SaveIngressRoute

func (c *Client) SaveIngressRoute(route *types.Ingress) error

func (*Client) SaveProject

func (c *Client) SaveProject(project string, services []types.Service) error

SaveProject will persist the project in the database.

func (*Client) SetAcmeChallenge

func (c *Client) SetAcmeChallenge(domain string, token string, auth string) error

SetAcmeChallenge will persist the ACME challenge for validating a certificate request.

func (*Client) SetCertificate

func (c *Client) SetCertificate(domain string, cert *types.Certificate) error

SetCertificate persists the certificate configuration for the domain.

type Config

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

func NewConfigDatabase

func NewConfigDatabase(c *Client) *Config

NewConfigDatabase creates a new database that only interacts with the configuration bucket.

func (*Config) ClearAcme

func (c *Config) ClearAcme()

func (*Config) GetAcmeEmail

func (c *Config) GetAcmeEmail() string

GetAcmeEmail will return the email address of the ACME user.

func (*Config) GetAcmePrivateKey

func (c *Config) GetAcmePrivateKey() crypto.PrivateKey

GetAcmePrivateKey will return the private key used to register the user via ACME.

func (*Config) GetAcmeRegistration

func (c *Config) GetAcmeRegistration() *registration.Resource

GetAcmeRegistration will return the registration resource we got from the ACME authority.

func (*Config) SetAcmeEmail

func (c *Config) SetAcmeEmail(email string)

SetAcmeEmail will configure the ACME user email.

func (*Config) SetAcmePrivateKey

func (c *Config) SetAcmePrivateKey(privateKey crypto.PrivateKey)

SetAcmePrivateKey will persist the ACME private key into the configuration bucket.

func (*Config) SetAcmeRegistration

func (c *Config) SetAcmeRegistration(registration *registration.Resource)

SetAcmeRegistration will persist the registration resources we got from the ACME authority.

Jump to

Keyboard shortcuts

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