Documentation ¶
Index ¶
Constants ¶
const ( PrivKeyFile = "MASA_PRIV_KEY_FILE" BootNodes = "BOOTNODES" MasaDir = "MASA_DIR" RpcUrl = "RPC_URL" PortNbr = "PORT_NBR" UDP = "UDP" TCP = "TCP" PrivateKey = "PRIVATE_KEY" StakeAmount = "STAKE_AMOUNT" LogLevel = "LOG_LEVEL" LogFilePath = "LOG_FILEPATH" Environment = "ENV" AllowedPeer = "allowedPeer" Signature = "signature" Debug = "debug" FilePath = "FILE_PATH" Validator = "VALIDATOR" CachePath = "CACHE_PATH" Faucet = "FAUCET" OracleProtocol = "oracle_protocol" WorkerProtocol = "worker_protocol" NodeDataSyncProtocol = "nodeDataSync" NodeGossipTopic = "gossip" PublicKeyTopic = "bootNodePublicKey" WorkerTopic = "workerTopic" BlockTopic = "blockTopic" Rendezvous = "masa-mdns" PageSize = 25 TwitterUsername = "TWITTER_USERNAME" TwitterPassword = "TWITTER_PASSWORD" Twitter2FaCode = "TWITTER_2FA_CODE" DiscordBotToken = "DISCORD_BOT_TOKEN" TwitterScraper = "TWITTER_SCRAPER" DiscordScraper = "DISCORD_SCRAPER" TelegramScraper = "TELEGRAM_SCRAPER" WebScraper = "WEB_SCRAPER" APIEnabled = "API_ENABLED" )
Variables ¶
This section is empty.
Functions ¶
func DisplayWelcomeMessage ¶
func InitOptions ¶ added in v0.8.7
func InitOptions(cfg *AppConfig) ([]node.Option, *workers.WorkHandlerManager, *pubsub.PublicKeySubscriptionHandler)
Types ¶
type AppConfig ¶
type AppConfig struct { Version string `mapstructure:"version"` PortNbr int `mapstructure:"portNbr"` UDP bool `mapstructure:"udp"` TCP bool `mapstructure:"tcp"` PrivateKey string `mapstructure:"privateKey"` Signature string `mapstructure:"signature"` Bootnodes []string `mapstructure:"bootnodes"` Data string `mapstructure:"data"` StakeAmount string `mapstructure:"stakeAmount"` Debug bool `mapstructure:"debug"` Environment string `mapstructure:"env"` PrivateKeyFile string `mapstructure:"privateKeyFile"` MasaDir string `mapstructure:"masaDir"` RpcUrl string `mapstructure:"rpcUrl"` AllowedPeer bool `mapstructure:"allowedPeer"` AllowedPeerId string `mapstructure:"allowedPeerId"` AllowedPeerPublicKey string `mapstructure:"allowedPeerPublicKey"` LogLevel string `mapstructure:"logLevel"` LogFilePath string `mapstructure:"logFilePath"` FilePath string `mapstructure:"filePath"` Validator bool `mapstructure:"validator"` CachePath string `mapstructure:"cachePath"` Faucet bool `mapstructure:"faucet"` // These may be moved to a separate struct TwitterCookiesPath string `mapstructure:"twitterCookiesPath"` TwitterUsername string `mapstructure:"twitterUsername"` TwitterPassword string `mapstructure:"twitterPassword"` Twitter2FaCode string `mapstructure:"twitter2FaCode"` DiscordBotToken string `mapstructure:"discordBotToken"` TwitterScraper bool `mapstructure:"twitterScraper"` DiscordScraper bool `mapstructure:"discordScraper"` TelegramScraper bool `mapstructure:"telegramScraper"` WebScraper bool `mapstructure:"webScraper"` APIEnabled bool `mapstructure:"api_enabled"` KeyManager *masacrypto.KeyManager TelegramStop bg.StopFunc }
AppConfig represents the configuration settings for the application. It holds various parameters and settings that control the behavior and runtime environment of the application. The fields in this struct are tagged with `mapstructure` to facilitate configuration loading from various sources such as configuration files, environment variables, and command-line flags using the `viper` library.
func GetConfig ¶ added in v0.8.7
GetConfig parses and fills in the AppConfig. The configuration values are generated by the following steps in order:
1. Set default configuration values. 2. Override with values from environment variables. 3. Override with values from the configuration file. 4. Override with command-line flags.
In case of any errors it returns nill with an error object
func (*AppConfig) LogConfig ¶
func (c *AppConfig) LogConfig()
LogConfig logs the non-sensitive parts of the AppConfig. Adjust the fields being logged according to your application's needs.
func (*AppConfig) SetupLogging ¶
func (c *AppConfig) SetupLogging()
SetupLogging configures the logging output for the application. It creates the log directory if needed, opens the log file, sets up a MultiWriter to log to both stdout and the log file, and configures the log level based on the Config.LogLevel field.