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