lightning-terminal/config_prod.go
Elle Mouton 7a091fc773
config: introduce the concept of DevConfig
In this commit, we introduce a DevConfig struct which is embedded in the
main lit Config struct. It is defined in two separate files that are
made mutually exclusive using the `dev` build tag. The idea of this
struct is that it allows us to expose additional config options to LiT
if we build in a development environment such as our itests. In other
words, we will be able to start developing features and testing them
before making them available to users via the production build.

As of this commit, both implementations of the struct are the same.
2025-02-21 11:17:21 -03:00

33 lines
948 B
Go

//go:build !dev
package terminal
import (
"path/filepath"
"github.com/lightninglabs/lightning-terminal/accounts"
"github.com/lightningnetwork/lnd/clock"
)
// DevConfig is an empty shell struct that allows us to build without the dev
// tag. This struct is embedded in the main Config struct, and it adds no new
// functionality in a production build.
type DevConfig struct{}
// defaultDevConfig returns an empty DevConfig struct.
func defaultDevConfig() *DevConfig {
return &DevConfig{}
}
// Validate is a no-op function during a production build.
func (c *DevConfig) Validate(_, _ string) error {
return nil
}
// NewAccountStore creates a new account store using the default Bolt backend
// since in production, this is the only backend supported currently.
func NewAccountStore(cfg *Config, clock clock.Clock) (accounts.Store, error) {
return accounts.NewBoltStore(
filepath.Dir(cfg.MacaroonPath), accounts.DBFilename, clock,
)
}