Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v7.2.89 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitTokenStore

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

GitTokenStore persists token records and auth metadata using git as the backing storage.

func NewGitTokenStore

func NewGitTokenStore(remote, username, password, branch string) *GitTokenStore

NewGitTokenStore creates a token store that saves credentials to disk through the TokenStorage implementation embedded in the token record. When branch is non-empty, clone/pull/push operations target that branch instead of the remote default.

func (*GitTokenStore) AuthDir

func (s *GitTokenStore) AuthDir() string

AuthDir returns the directory used for auth persistence.

func (*GitTokenStore) ConfigPath

func (s *GitTokenStore) ConfigPath() string

ConfigPath returns the managed config file path.

func (*GitTokenStore) Delete

func (s *GitTokenStore) Delete(_ context.Context, id string) error

Delete removes the auth file.

func (*GitTokenStore) EnsureRepository

func (s *GitTokenStore) EnsureRepository() error

EnsureRepository prepares the local git working tree by cloning or opening the repository.

func (*GitTokenStore) List

List enumerates all auth JSON files under the configured directory.

func (*GitTokenStore) PersistAuthFiles

func (s *GitTokenStore) PersistAuthFiles(_ context.Context, message string, paths ...string) error

PersistAuthFiles commits and pushes the provided paths to the remote repository. It no-ops when the store is not fully configured or when there are no paths.

func (*GitTokenStore) PersistConfig

func (s *GitTokenStore) PersistConfig(_ context.Context) error

PersistConfig commits and pushes configuration changes to git.

func (*GitTokenStore) Save

func (s *GitTokenStore) Save(_ context.Context, auth *cliproxyauth.Auth) (string, error)

Save persists token storage and metadata to the resolved auth file path.

func (*GitTokenStore) SetBaseDir

func (s *GitTokenStore) SetBaseDir(dir string)

SetBaseDir updates the default directory used for auth JSON persistence when no explicit path is provided.

type ObjectStoreConfig

type ObjectStoreConfig struct {
	Endpoint  string
	Bucket    string
	AccessKey string
	SecretKey string
	Region    string
	Prefix    string
	LocalRoot string
	UseSSL    bool
	PathStyle bool
}

ObjectStoreConfig captures configuration for the object storage-backed token store.

type ObjectTokenStore

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

ObjectTokenStore persists configuration and authentication metadata using an S3-compatible object storage backend. Files are mirrored to a local workspace so existing file-based flows continue to operate.

func NewObjectTokenStore

func NewObjectTokenStore(cfg ObjectStoreConfig) (*ObjectTokenStore, error)

NewObjectTokenStore initializes an object storage backed token store.

func (*ObjectTokenStore) AuthDir

func (s *ObjectTokenStore) AuthDir() string

AuthDir returns the local directory containing mirrored auth files.

func (*ObjectTokenStore) Bootstrap

func (s *ObjectTokenStore) Bootstrap(ctx context.Context, exampleConfigPath string) error

Bootstrap ensures the target bucket exists and synchronizes data from the object storage backend.

func (*ObjectTokenStore) ConfigPath

func (s *ObjectTokenStore) ConfigPath() string

ConfigPath returns the managed configuration file path inside the spool directory.

func (*ObjectTokenStore) Delete

func (s *ObjectTokenStore) Delete(ctx context.Context, id string) error

Delete removes an auth file locally and remotely.

func (*ObjectTokenStore) List

List enumerates auth JSON files from the mirrored workspace.

func (*ObjectTokenStore) PersistAuthFiles

func (s *ObjectTokenStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error

PersistAuthFiles uploads the provided auth files to the object storage backend.

func (*ObjectTokenStore) PersistConfig

func (s *ObjectTokenStore) PersistConfig(ctx context.Context) error

PersistConfig uploads the local configuration file to the object storage backend.

func (*ObjectTokenStore) Save

func (s *ObjectTokenStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)

Save persists authentication metadata to disk and uploads it to the object storage backend.

func (*ObjectTokenStore) SetBaseDir

func (s *ObjectTokenStore) SetBaseDir(string)

SetBaseDir implements the optional interface used by authenticators; it is a no-op because the object store controls its own workspace.

type PostgresStore

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

PostgresStore persists configuration and authentication metadata using PostgreSQL as backend while mirroring data to a local workspace so existing file-based workflows continue to operate.

func NewPostgresStore

func NewPostgresStore(ctx context.Context, cfg PostgresStoreConfig) (*PostgresStore, error)

NewPostgresStore establishes a connection to PostgreSQL and prepares the local workspace.

func (*PostgresStore) AuthDir

func (s *PostgresStore) AuthDir() string

AuthDir returns the local directory containing mirrored auth files.

func (*PostgresStore) Bootstrap

func (s *PostgresStore) Bootstrap(ctx context.Context, exampleConfigPath string) error

Bootstrap synchronizes configuration and auth records between PostgreSQL and the local workspace.

func (*PostgresStore) Close

func (s *PostgresStore) Close() error

Close releases the underlying database connection.

func (*PostgresStore) ConfigPath

func (s *PostgresStore) ConfigPath() string

ConfigPath returns the managed configuration file path inside the spool directory.

func (*PostgresStore) CooldownStateStore added in v7.2.88

func (s *PostgresStore) CooldownStateStore() cliproxyauth.CooldownStateStore

CooldownStateStore returns the PostgreSQL-backed runtime cooldown store.

func (*PostgresStore) Delete

func (s *PostgresStore) Delete(ctx context.Context, id string) error

Delete removes an auth file and the corresponding database record.

func (*PostgresStore) EnsureSchema

func (s *PostgresStore) EnsureSchema(ctx context.Context) error

EnsureSchema creates the required tables (and schema when provided).

func (*PostgresStore) List

func (s *PostgresStore) List(ctx context.Context) ([]*cliproxyauth.Auth, error)

List enumerates all auth records stored in PostgreSQL.

func (*PostgresStore) PersistAuthFiles

func (s *PostgresStore) PersistAuthFiles(ctx context.Context, _ string, paths ...string) error

PersistAuthFiles stores the provided auth file changes in PostgreSQL.

func (*PostgresStore) PersistConfig

func (s *PostgresStore) PersistConfig(ctx context.Context) error

PersistConfig mirrors the local configuration file to PostgreSQL.

func (*PostgresStore) Save

func (s *PostgresStore) Save(ctx context.Context, auth *cliproxyauth.Auth) (string, error)

Save persists authentication metadata to disk and PostgreSQL.

func (*PostgresStore) SetBaseDir

func (s *PostgresStore) SetBaseDir(string)

SetBaseDir implements the optional interface used by authenticators; it is a no-op because the Postgres-backed store controls its own workspace.

func (*PostgresStore) WorkDir

func (s *PostgresStore) WorkDir() string

WorkDir exposes the root spool directory used for mirroring.

type PostgresStoreConfig

type PostgresStoreConfig struct {
	DSN           string
	Schema        string
	ConfigTable   string
	AuthTable     string
	CooldownTable string
	SpoolDir      string
}

PostgresStoreConfig captures configuration required to initialize a Postgres-backed store.

Jump to

Keyboard shortcuts

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