admincmd

package
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package admincmd provides reusable cobra commands for self-hosted administrator helpers. Both the management and combined binaries use these commands, each providing their own opener to handle config loading and storage initialization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseIDPStorage

func CloseIDPStorage(s storage.Storage)

CloseIDPStorage closes embedded IdP storage and logs cleanup errors at debug level.

func CloseStore

func CloseStore(ctx context.Context, s store.Store)

CloseStore closes the management store and logs cleanup errors at debug level.

func NewCommands

func NewCommands(openers Openers) *cobra.Command

NewCommands creates the admin command tree with the given resource openers.

func OpenEmbeddedIDPStorage

func OpenEmbeddedIDPStorage(cfg *idp.EmbeddedIdPConfig) (storage.Storage, error)

OpenEmbeddedIDPStorage opens the Dex storage configured for the embedded IdP.

func OpenIDPStorage

func OpenIDPStorage(config *nbconfig.Config) (storage.Storage, string, error)

OpenIDPStorage opens embedded IdP storage and returns its sqlite file path when applicable.

Types

type IDPOpener

type IDPOpener func(cmd *cobra.Command, fn func(ctx context.Context, idpStorage storage.Storage, storageFile string) error) error

IDPOpener initializes only the embedded IdP storage from the command context and calls fn.

type Opener

type Opener func(cmd *cobra.Command, fn func(ctx context.Context, resources Resources) error) error

Opener initializes command resources from the command context and calls fn.

type Openers

type Openers struct {
	Resources Opener
	Store     StoreOpener
	IDP       IDPOpener
}

Openers contains the resource openers needed by the admin command tree.

type Resources

type Resources struct {
	Store          store.Store
	IDPStorage     storage.Storage
	IDPStorageFile string
	EventStore     activity.Store
}

Resources contains the storages required by the admin commands.

type StoreOpener

type StoreOpener func(cmd *cobra.Command, fn func(ctx context.Context, s store.Store) error) error

StoreOpener initializes only the management store from the command context and calls fn.

Jump to

Keyboard shortcuts

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