mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
ed272b256d
* Remove pairs from EVM chain tokelists.json * Add tokenlist-extended.json * Add command for adding token to tokenlist-extended.json * Remove empty pairs * Update config namings * Add command for adding token to tokenlist.json * Update config and file namings * Update tokenlist-extended.json * Add token info getting * Fix * Fix * Add duplicates check * Add duplicate check in token list * Update commands.go Co-authored-by: Viktor Radchenko <1641795+vikmeup@users.noreply.github.com>
59 lines
1.7 KiB
Go
59 lines
1.7 KiB
Go
package config
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/trustwallet/go-libs/config/viper"
|
|
)
|
|
|
|
type (
|
|
Config struct {
|
|
App App `mapstructure:"app"`
|
|
ClientURLs ClientURLs `mapstructure:"client_urls"`
|
|
URLs URLs `mapstructure:"urls"`
|
|
TimeFormat string `mapstructure:"time_format"`
|
|
ValidatorsSettings ValidatorsSettings `mapstructure:"validators_settings"`
|
|
}
|
|
|
|
App struct {
|
|
LogLevel string `mapstructure:"log_level"`
|
|
}
|
|
|
|
ClientURLs struct {
|
|
Binance struct {
|
|
Dex string `mapstructure:"dex"`
|
|
Explorer string `mapstructure:"explorer"`
|
|
} `mapstructure:"binance"`
|
|
AssetsManagerAPI string `mapstructure:"assets_manager_api"`
|
|
}
|
|
|
|
URLs struct {
|
|
AssetsApp string `mapstructure:"assets_app"`
|
|
Logo string `mapstructure:"logo"`
|
|
}
|
|
|
|
ValidatorsSettings struct {
|
|
RootFolder RootFolder `mapstructure:"root_folder"`
|
|
ChainFolder ChainFolder `mapstructure:"chain_folder"`
|
|
AssetFolder AssetFolder `mapstructure:"asset_folder"`
|
|
ChainInfoFolder ChainInfoFolder `mapstructure:"chain_info_folder"`
|
|
ChainValidatorsAssetFolder ChainValidatorsAssetFolder `mapstructure:"chain_validators_asset_folder"`
|
|
DappsFolder DappsFolder `mapstructure:"dapps_folder"`
|
|
}
|
|
)
|
|
|
|
// Default is a configuration instance.
|
|
var Default = Config{} // nolint:gochecknoglobals // config must be global
|
|
|
|
// SetConfig reads a config file and returs an initialized config instance.
|
|
func SetConfig(confPath string) error {
|
|
confPath, err := filepath.Abs(confPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
viper.Load(confPath, &Default)
|
|
|
|
return nil
|
|
}
|