Documentation ¶
Overview ¶
Code generated for package repo by go-bindata DO NOT EDIT. (@generated) sources: sample-filehive.conf
Index ¶
- Constants
- Variables
- func AppDataDir(appName string, roaming bool) string
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func TstAppDataDir(goos, appName string, roaming bool) string
- func VersionString() string
- type Config
- type Database
- type Option
- type Options
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func TstAppDataDir ¶
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 ¶
LoadConfig initializes and parses the config using a config file and command line options.
The configuration proceeds as follows:
- Start with a default config with sane settings
- Pre-parse the command line to check for an alternative config file
- Load configuration file overwriting defaults with any specified options
- 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 ¶
NewDatabase returns a new database with the given options. Sqlite3, Mysql, and Postgress is supported.