mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 23:16:49 +00:00
Lowercase json to be more compliant with javascript coding standards (#163)
This commit is contained in:
committed by
Adrian Gallagher
parent
c63f1b0ff6
commit
6c2f6df875
202
config/config.go
202
config/config.go
@@ -33,8 +33,8 @@ const (
|
||||
configMaxAuthFailres = 3
|
||||
)
|
||||
|
||||
// Variables here are mainly alerts and a configuration object
|
||||
var (
|
||||
// Constants here hold some messages
|
||||
const (
|
||||
ErrExchangeNameEmpty = "Exchange #%d in config: Exchange name is empty."
|
||||
ErrExchangeAvailablePairsEmpty = "Exchange %s: Available pairs is empty."
|
||||
ErrExchangeEnabledPairsEmpty = "Exchange %s: Enabled pairs is empty."
|
||||
@@ -54,166 +54,170 @@ var (
|
||||
WarningExchangeAuthAPIDefaultOrEmptyValues = "WARNING -- Exchange %s: Authenticated API support disabled due to default/empty APIKey/Secret/ClientID values."
|
||||
WarningCurrencyExchangeProvider = "WARNING -- Currency exchange provider invalid valid. Reset to Fixer."
|
||||
WarningPairsLastUpdatedThresholdExceeded = "WARNING -- Exchange %s: Last manual update of available currency pairs has exceeded %d days. Manual update required!"
|
||||
Cfg Config
|
||||
IsInitialSetup bool
|
||||
testBypass bool
|
||||
m sync.Mutex
|
||||
)
|
||||
|
||||
// Variables here are used for configuration
|
||||
var (
|
||||
Cfg Config
|
||||
IsInitialSetup bool
|
||||
testBypass bool
|
||||
m sync.Mutex
|
||||
)
|
||||
|
||||
// WebserverConfig struct holds the prestart variables for the webserver.
|
||||
type WebserverConfig struct {
|
||||
Enabled bool
|
||||
AdminUsername string
|
||||
AdminPassword string
|
||||
ListenAddress string
|
||||
WebsocketConnectionLimit int
|
||||
WebsocketMaxAuthFailures int
|
||||
WebsocketAllowInsecureOrigin bool
|
||||
Enabled bool `json:"enabled"`
|
||||
AdminUsername string `json:"adminUsername"`
|
||||
AdminPassword string `json:"adminPassword"`
|
||||
ListenAddress string `json:"listenAddress"`
|
||||
WebsocketConnectionLimit int `json:"websocketConnectionLimit"`
|
||||
WebsocketMaxAuthFailures int `json:"websocketMaxAuthFailures"`
|
||||
WebsocketAllowInsecureOrigin bool `json:"websocketAllowInsecureOrigin"`
|
||||
}
|
||||
|
||||
// Post holds the bot configuration data
|
||||
type Post struct {
|
||||
Data Config `json:"Data"`
|
||||
Data Config `json:"data"`
|
||||
}
|
||||
|
||||
// CurrencyPairFormatConfig stores the users preferred currency pair display
|
||||
type CurrencyPairFormatConfig struct {
|
||||
Uppercase bool
|
||||
Delimiter string `json:",omitempty"`
|
||||
Separator string `json:",omitempty"`
|
||||
Index string `json:",omitempty"`
|
||||
Uppercase bool `json:"uppercase"`
|
||||
Delimiter string `json:"delimiter,omitempty"`
|
||||
Separator string `json:"separator,omitempty"`
|
||||
Index string `json:"index,omitempty"`
|
||||
}
|
||||
|
||||
// Config is the overarching object that holds all the information for
|
||||
// prestart management of Portfolio, Communications, Webserver and Enabled
|
||||
// Exchanges
|
||||
type Config struct {
|
||||
Name string
|
||||
EncryptConfig int
|
||||
GlobalHTTPTimeout time.Duration `json:"GlobalHTTPTimeout"`
|
||||
Currency CurrencyConfig `json:"CurrencyConfig"`
|
||||
Communications CommunicationsConfig `json:"Communications"`
|
||||
Portfolio portfolio.Base `json:"PortfolioAddresses"`
|
||||
Webserver WebserverConfig `json:"Webserver"`
|
||||
Exchanges []ExchangeConfig `json:"Exchanges"`
|
||||
BankAccounts []BankAccount `json:"BankAccounts"`
|
||||
Name string `json:"name"`
|
||||
EncryptConfig int `json:"encryptConfig"`
|
||||
GlobalHTTPTimeout time.Duration `json:"globalHTTPTimeout"`
|
||||
Currency CurrencyConfig `json:"currencyConfig"`
|
||||
Communications CommunicationsConfig `json:"communications"`
|
||||
Portfolio portfolio.Base `json:"portfolioAddresses"`
|
||||
Webserver WebserverConfig `json:"webserver"`
|
||||
Exchanges []ExchangeConfig `json:"exchanges"`
|
||||
BankAccounts []BankAccount `json:"bankAccounts"`
|
||||
|
||||
// Deprecated config settings, will be removed at a future date
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"CurrencyPairFormat,omitempty"`
|
||||
FiatDisplayCurrency string `json:"FiatDispayCurrency,omitempty"`
|
||||
Cryptocurrencies string `json:"Cryptocurrencies,omitempty"`
|
||||
SMS *SMSGlobalConfig `json:"SMSGlobal,omitempty"`
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"currencyPairFormat,omitempty"`
|
||||
FiatDisplayCurrency string `json:"fiatDispayCurrency,omitempty"`
|
||||
Cryptocurrencies string `json:"cryptocurrencies,omitempty"`
|
||||
SMS *SMSGlobalConfig `json:"smsGlobal,omitempty"`
|
||||
}
|
||||
|
||||
// ExchangeConfig holds all the information needed for each enabled Exchange.
|
||||
type ExchangeConfig struct {
|
||||
Name string
|
||||
Enabled bool
|
||||
Verbose bool
|
||||
Websocket bool
|
||||
UseSandbox bool
|
||||
RESTPollingDelay time.Duration
|
||||
HTTPTimeout time.Duration
|
||||
AuthenticatedAPISupport bool
|
||||
APIKey string
|
||||
APISecret string
|
||||
APIAuthPEMKey string `json:",omitempty"`
|
||||
ClientID string `json:",omitempty"`
|
||||
AvailablePairs string
|
||||
EnabledPairs string
|
||||
BaseCurrencies string
|
||||
AssetTypes string
|
||||
SupportsAutoPairUpdates bool
|
||||
PairsLastUpdated int64 `json:",omitempty"`
|
||||
ConfigCurrencyPairFormat *CurrencyPairFormatConfig `json:"ConfigCurrencyPairFormat"`
|
||||
RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"RequestCurrencyPairFormat"`
|
||||
BankAccounts []BankAccount
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Verbose bool `json:"verbose"`
|
||||
Websocket bool `json:"websocket"`
|
||||
UseSandbox bool `json:"useSandbox"`
|
||||
RESTPollingDelay time.Duration `json:"restPollingDelay"`
|
||||
HTTPTimeout time.Duration `json:"httpTimeout"`
|
||||
AuthenticatedAPISupport bool `json:"authenticatedApiSupport"`
|
||||
APIKey string `json:"apiKey"`
|
||||
APISecret string `json:"apiSecret"`
|
||||
APIAuthPEMKey string `json:"apiAuthPemKey,omitempty"`
|
||||
ClientID string `json:"clientId,omitempty"`
|
||||
AvailablePairs string `json:"availablePairs"`
|
||||
EnabledPairs string `json:"enabledPairs"`
|
||||
BaseCurrencies string `json:"baseCurrencies"`
|
||||
AssetTypes string `json:"assetTypes"`
|
||||
SupportsAutoPairUpdates bool `json:"supportsAutoPairUpdates"`
|
||||
PairsLastUpdated int64 `json:"pairsLastUpdated,omitempty"`
|
||||
ConfigCurrencyPairFormat *CurrencyPairFormatConfig `json:"configCurrencyPairFormat"`
|
||||
RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"requestCurrencyPairFormat"`
|
||||
BankAccounts []BankAccount `json:"bankAccounts"`
|
||||
}
|
||||
|
||||
// BankAccount holds differing bank account details by supported funding
|
||||
// currency
|
||||
type BankAccount struct {
|
||||
Enabled bool `json:",omitempty"`
|
||||
BankName string
|
||||
BankAddress string
|
||||
AccountName string
|
||||
AccountNumber string
|
||||
SWIFTCode string
|
||||
IBAN string
|
||||
BSBNumber string `json:",omitempty"`
|
||||
SupportedCurrencies string
|
||||
SupportedExchanges string `json:",omitempty"`
|
||||
Enabled bool `json:",omitempty"`
|
||||
BankName string `json:"bankName"`
|
||||
BankAddress string `json:"bankAddress"`
|
||||
AccountName string `json:"accountName"`
|
||||
AccountNumber string `json:"accountNumber"`
|
||||
SWIFTCode string `json:"swiftCode"`
|
||||
IBAN string `json:"iban"`
|
||||
BSBNumber string `json:"bsbNumber,omitempty"`
|
||||
SupportedCurrencies string `json:"supportedCurrencies"`
|
||||
SupportedExchanges string `json:"supportedExchanges,omitempty"`
|
||||
}
|
||||
|
||||
// BankTransaction defines a related banking transaction
|
||||
type BankTransaction struct {
|
||||
ReferenceNumber string
|
||||
TransactionNumber string
|
||||
PaymentInstructions string
|
||||
ReferenceNumber string `json:"referenceNumber"`
|
||||
TransactionNumber string `json:"transactionNumber"`
|
||||
PaymentInstructions string `json:"paymentInstructions"`
|
||||
}
|
||||
|
||||
// CurrencyConfig holds all the information needed for currency related manipulation
|
||||
type CurrencyConfig struct {
|
||||
ForexProviders []base.Settings `json:"ForexProviders"`
|
||||
Cryptocurrencies string `json:"Cryptocurrencies"`
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"CurrencyPairFormat"`
|
||||
FiatDisplayCurrency string
|
||||
ForexProviders []base.Settings `json:"forexProviders"`
|
||||
Cryptocurrencies string `json:"cryptocurrencies"`
|
||||
CurrencyPairFormat *CurrencyPairFormatConfig `json:"currencyPairFormat"`
|
||||
FiatDisplayCurrency string `json:"fiatDisplayCurrency"`
|
||||
}
|
||||
|
||||
// CommunicationsConfig holds all the information needed for each
|
||||
// enabled communication package
|
||||
type CommunicationsConfig struct {
|
||||
SlackConfig SlackConfig `json:"Slack"`
|
||||
SMSGlobalConfig SMSGlobalConfig `json:"SMSGlobal"`
|
||||
SMTPConfig SMTPConfig `json:"SMTP"`
|
||||
TelegramConfig TelegramConfig `json:"Telegram"`
|
||||
SlackConfig SlackConfig `json:"slack"`
|
||||
SMSGlobalConfig SMSGlobalConfig `json:"smsGlobal"`
|
||||
SMTPConfig SMTPConfig `json:"smtp"`
|
||||
TelegramConfig TelegramConfig `json:"telegram"`
|
||||
}
|
||||
|
||||
// SlackConfig holds all variables to start and run the Slack package
|
||||
type SlackConfig struct {
|
||||
Name string `json:"Name"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Verbose bool `json:"Verbose"`
|
||||
TargetChannel string `json:"TargetChannel"`
|
||||
VerificationToken string `json:"VerificationToken"`
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Verbose bool `json:"verbose"`
|
||||
TargetChannel string `json:"targetChannel"`
|
||||
VerificationToken string `json:"verificationToken"`
|
||||
}
|
||||
|
||||
// SMSContact stores the SMS contact info
|
||||
type SMSContact struct {
|
||||
Name string `json:"Name"`
|
||||
Number string `json:"Number"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Name string `json:"name"`
|
||||
Number string `json:"number"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SMSGlobalConfig structure holds all the variables you need for instant
|
||||
// messaging and broadcast used by SMSGlobal
|
||||
type SMSGlobalConfig struct {
|
||||
Name string `json:"Name"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Verbose bool `json:"Verbose"`
|
||||
Username string `json:"Username"`
|
||||
Password string `json:"Password"`
|
||||
Contacts []SMSContact `json:"Contacts"`
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Verbose bool `json:"verbose"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Contacts []SMSContact `json:"contacts"`
|
||||
}
|
||||
|
||||
// SMTPConfig holds all variables to start and run the SMTP package
|
||||
type SMTPConfig struct {
|
||||
Name string `json:"Name"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Verbose bool `json:"Verbose"`
|
||||
Host string `json:"Host"`
|
||||
Port string `json:"Port"`
|
||||
AccountName string `json:"AccountName"`
|
||||
AccountPassword string `json:"AccountPassword"`
|
||||
RecipientList string `json:"RecipientList"`
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Verbose bool `json:"verbose"`
|
||||
Host string `json:"host"`
|
||||
Port string `json:"port"`
|
||||
AccountName string `json:"accountName"`
|
||||
AccountPassword string `json:"accountPassword"`
|
||||
RecipientList string `json:"recipientList"`
|
||||
}
|
||||
|
||||
// TelegramConfig holds all variables to start and run the Telegram package
|
||||
type TelegramConfig struct {
|
||||
Name string `json:"Name"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Verbose bool `json:"Verbose"`
|
||||
VerificationToken string `json:"VerificationToken"`
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Verbose bool `json:"verbose"`
|
||||
VerificationToken string `json:"verificationToken"`
|
||||
}
|
||||
|
||||
// GetCurrencyConfig returns currency configurations
|
||||
|
||||
Reference in New Issue
Block a user