config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ProfilesDirName = "signature_profiles"
	RecentFilesName = "recent.json"
)

Names of the files kept next to config.json.

Variables

This section is empty.

Functions

func Dir added in v1.0.1

func Dir() (string, error)

Dir returns the folder that holds config.json, the signature profiles and the recent files: lankir under the user config dir, which on Linux follows XDG_CONFIG_HOME. Lankir 1.0 kept the profiles and recent files in ~/.config/lankir whatever XDG_CONFIG_HOME said; when Dir is elsewhere and has none of them yet, they are copied over. The originals stay.

Types

type Config

type Config struct {
	// Appearance settings
	Theme       string `json:"theme"`
	AccentColor string `json:"accentColor"`

	// Viewer settings
	DefaultZoom      int    `json:"defaultZoom"`
	ShowLeftSidebar  bool   `json:"showLeftSidebar"`
	ShowRightSidebar bool   `json:"showRightSidebar"`
	DefaultViewMode  string `json:"defaultViewMode"` // "single" or "scroll"

	// File settings
	RecentFilesLength int `json:"recentFilesLength"`
	AutosaveInterval  int `json:"autosaveInterval"`

	// Certificate settings
	CertificateStores []string `json:"certificateStores"`
	TokenLibraries    []string `json:"tokenLibraries"`

	// Signing settings
	TSAURL                  string `json:"tsaUrl"`
	SignatureLocationLookup bool   `json:"signatureLocationLookup"`
	// CheckRevocationOnline asks the OCSP/CRL servers a signer's certificate
	// names whether it was revoked, when verifying signatures.
	CheckRevocationOnline      bool   `json:"checkRevocationOnline"`
	LastCertificateFingerprint string `json:"lastCertificateFingerprint"`
	LastSignatureProfileID     string `json:"lastSignatureProfileId"`

	// Advanced settings
	DebugMode     bool `json:"debugMode"`
	HardwareAccel bool `json:"hardwareAccel"`
}

Config holds all application settings persisted to disk.

type Service

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

Service provides thread-safe access to application configuration.

func NewService

func NewService() (*Service, error)

NewService creates a config service using the default config directory.

func NewServiceWithDir

func NewServiceWithDir(configDir string) (*Service, error)

NewServiceWithDir creates a config service using a custom directory.

func (*Service) Get

func (s *Service) Get() *Config

Get returns a copy of the current configuration.

func (*Service) Load

func (s *Service) Load() error

Load reads configuration from disk into memory.

func (*Service) Reset

func (s *Service) Reset() error

Reset restores default settings and saves to disk.

func (*Service) Save

func (s *Service) Save() error

Save writes the current configuration to disk atomically.

func (*Service) SetLastSigning added in v1.0.0

func (s *Service) SetLastSigning(certFingerprint, profileID string) error

SetLastSigning saves the certificate and profile of the last signature. It changes only those two fields of config.json as it is on disk, so settings another window saved since Load are kept.

func (*Service) Update

func (s *Service) Update(config *Config) error

Update replaces the configuration and saves it to disk.

Jump to

Keyboard shortcuts

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