repo

package
v0.0.0-...-7fbff23 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Code generated for package repo by go-bindata DO NOT EDIT. (@generated) sources: sample-filehive.conf

Index

Constants

View Source
const (
	AppMajor uint = 0
	AppMinor uint = 1
	AppPatch uint = 0

	// AppPreRelease MUST only contain characters from semanticAlphabet
	// per the semantic versioning spec.
	AppPreRelease = "dev"
)

These constants define the application version and follow the semantic versioning 2.0.0 spec (http://semver.org/).

Variables

View Source
var (
	DefaultHomeDir = AppDataDir("filehive", false)

	LogLevelMap = map[string]logging.Level{
		"debug":    logging.DEBUG,
		"info":     logging.INFO,
		"notice":   logging.NOTICE,
		"warning":  logging.WARNING,
		"error":    logging.ERROR,
		"critical": logging.CRITICAL,
	}
)

Functions

func AppDataDir

func AppDataDir(appName string, roaming bool) string

AppDataDir returns an operating system specific directory to be used for storing application data for an application.

The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.

The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.

Example results:

dir := AppDataDir("myapp", false)
 POSIX (Linux/BSD): ~/.myapp
 Mac OS: $HOME/Library/Application Support/Myapp
 Windows: %LOCALAPPDATA%\Myapp
 Plan 9: $home/myapp

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func TstAppDataDir

func TstAppDataDir(goos, appName string, roaming bool) string

TstAppDataDir makes the internal appDataDir function available to the test package.

func VersionString

func VersionString() string

VersionString returns the application version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).

Types

type Config

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"`
	DataDir     string `short:"d" long:"datadir" description:"Directory to store data"`
	LogDir      string `long:"logdir" description:"Directory to log output."`
	LogLevel    string `long:"loglevel" description:"Set the logging level [debug, info, notice, warning, error, critical]." default:"info"`
	TestMode    bool   `long:"testmode" description:"Run the server in test mode. This will use a mock filecoin backend."`

	Listen        string `short:"l" long:"listen" description:"The interface:port for the app server to bind to." default:"0.0.0.0:8080"`
	StaticFileDir string `` /* 151-byte string literal not displayed */
	Domain        string `short:"D" long:"domain" description:"Set the domain the server will run on"`
	UseSSL        bool   `long:"usessl" description:"Set to true if you want to use SSL with the server."`
	SSLCert       string `long:"sslcert" description:"Path to the SSL certificate."`
	SSLKey        string `long:"sslkey" description:"Path to the SSL key."`

	DBDialect string `long:"dbdialect" description:"The type of database to use [sqlite3, mysql, postgress, memory]" default:"sqlite3"`
	DBHost    string `long:"dbhost" description:"The host:post location of the database."`
	DBUser    string `long:"dbuser" description:"The database username"`
	DBPass    string `long:"dbpass" description:"The database password"`

	PowergateToken  string `long:"powtoken" description:"The Powergate admin token"`
	FilecoinAddress string `long:"filecoinaddress" description:"Filecoin address for payouts"`
	PowergateHost   string `long:"powergate" description:"Hostname for the Powergate instance"`
	MailgunKey      string `long:"mailgunkey" description:"API key for Mailgun"`
	MailDomain      string `long:"maildomain" description:"Domain to send email"`
}

Config defines the configuration options for the crawler.

See LoadConfig for details on the configuration load process.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig initializes and parses the config using a config file and command line options.

The configuration proceeds as follows:

  1. Start with a default config with sane settings
  2. Pre-parse the command line to check for an alternative config file
  3. Load configuration file overwriting defaults with any specified options
  4. Parse CLI options and overwrite/add any specified options

The above results in OpenBazaar functioning properly without any config settings while still allowing the user to override settings with config files and command line options. Command line options always take precedence.

type Database

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

Database is a mutex wrapper around a GORM db.

func NewDatabase

func NewDatabase(dataDir string, opts ...Option) (*Database, error)

NewDatabase returns a new database with the given options. Sqlite3, Mysql, and Postgress is supported.

func (*Database) Update

func (d *Database) Update(fn func(db *gorm.DB) error) error

Update is used for write access to the db. Updates are made inside an open transaction.

func (*Database) View

func (d *Database) View(fn func(db *gorm.DB) error) error

View is used for read access to the db. Reads are made inside and open transaction.

type Option

type Option func(*Options) error

Option represents a db option.

func Dialect

func Dialect(dialect string) Option

Dialect sets the database type...sqlite3, mysql, postress.

func Host

func Host(host string) Option

Host option allows you to set the host for mysql or postgress dbs.

func Password

func Password(pw string) Option

Password is the password for the mysql or postgress dbs.

func Port

func Port(port uint) Option

Port option sets the port for mysql or postgress dbs.

func Username

func Username(user string) Option

Username is the username for the mysql or postgress dbs.

type Options

type Options struct {
	Host     string
	Port     uint
	Dialect  string
	User     string
	Password string
}

Options represents the database options.

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

Apply sets the provided options in the main options struct.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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