Exemple #1
0
// cleanAndExpandPath expands environement variables and leading ~ in the
// passed path, cleans the result, and returns it.
func cleanAndExpandPath(path string) string {
	// Expand initial ~ to OS specific home directory.
	if strings.HasPrefix(path, "~") {
		appHomeDir := btcutil.AppDataDir("gencerts", false)
		homeDir := filepath.Dir(appHomeDir)
		path = strings.Replace(path, "~", homeDir, 1)
	}

	// NOTE: The os.ExpandEnv doesn't work with Windows-style %VARIABLE%,
	// but they variables can still be expanded via POSIX-style $VARIABLE.
	return filepath.Clean(os.ExpandEnv(path))
}
Exemple #2
0
	defaultBanDuration       = time.Hour * 24
	defaultMaxRPCClients     = 10
	defaultMaxRPCWebsockets  = 25
	defaultVerifyEnabled     = false
	defaultDbType            = "leveldb"
	defaultFreeTxRelayLimit  = 15.0
	defaultBlockMinSize      = 0
	defaultBlockMaxSize      = 750000
	blockMaxSizeMin          = 1000
	blockMaxSizeMax          = btcwire.MaxBlockPayload - 1000
	defaultBlockPrioritySize = 50000
	defaultGenerate          = false
)

var (
	pointcoindHomeDir  = btcutil.AppDataDir("pointcoind", false)
	defaultConfigFile  = filepath.Join(pointcoindHomeDir, defaultConfigFilename)
	defaultDataDir     = filepath.Join(pointcoindHomeDir, defaultDataDirname)
	knownDbTypes       = database.SupportedDBs()
	defaultRPCKeyFile  = filepath.Join(pointcoindHomeDir, "rpc.key")
	defaultRPCCertFile = filepath.Join(pointcoindHomeDir, "rpc.cert")
	defaultLogDir      = filepath.Join(pointcoindHomeDir, defaultLogDirname)
)

// runServiceCommand is only set to a real function on Windows.  It is used
// to parse and execute service commands specified via the -s flag.
var runServiceCommand func(string) error

// config defines the configuration options for pointcoind.
//
// See loadConfig for details on the configuration load process.
Exemple #3
0
package main

import (
	"fmt"
	"net"
	"os"
	"path/filepath"
	"strings"

	"github.com/PointCoin/btcutil"
	flags "github.com/PointCoin/go-flags"
)

var (
	pointcoindHomeDir     = btcutil.AppDataDir("pointcoind", false)
	btcctlHomeDir         = btcutil.AppDataDir("pointctl", false)
	btcwalletHomeDir      = btcutil.AppDataDir("wallet", false)
	defaultConfigFile     = filepath.Join(btcctlHomeDir, "pointctl.conf")
	defaultRPCServer      = "localhost"
	defaultRPCCertFile    = filepath.Join(pointcoindHomeDir, "rpc.cert")
	defaultWalletCertFile = filepath.Join(btcwalletHomeDir, "rpc.cert")
)

// config defines the configuration options for btcctl.
//
// See loadConfig for details on the configuration load process.
type config struct {
	ShowVersion   bool   `short:"V" long:"version" description:"Display version information and exit"`
	ConfigFile    string `short:"C" long:"configfile" description:"Path to configuration file"`
	RPCUser       string `short:"u" long:"rpcuser" description:"RPC username"`
	RPCPassword   string `short:"P" long:"rpcpass" default-mask:"-" description:"RPC password"`