-
-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WTF-400 Bittrex extracted to new config format
- Loading branch information
Chris Cummer
committed
Apr 15, 2019
1 parent
fbf8944
commit 3db2848
Showing
6 changed files
with
75 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package bittrex | ||
|
||
import ( | ||
"github.com/olebedev/config" | ||
"github.com/wtfutil/wtf/cfg" | ||
) | ||
|
||
type colors struct { | ||
base struct { | ||
name string | ||
displayName string | ||
} | ||
market struct { | ||
name string | ||
field string | ||
value string | ||
} | ||
} | ||
|
||
type Settings struct { | ||
colors | ||
common *cfg.Common | ||
|
||
summary map[string]interface{} | ||
} | ||
|
||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings { | ||
localConfig, _ := ymlConfig.Get("wtf.mods.bittrex") | ||
|
||
settings := Settings{ | ||
common: cfg.NewCommonSettingsFromYAML(ymlConfig), | ||
} | ||
|
||
settings.colors.base.name = localConfig.UString("colors.base.name") | ||
settings.colors.base.displayName = localConfig.UString("colors.base.displayName") | ||
|
||
settings.colors.market.name = localConfig.UString("colors.market.name") | ||
settings.colors.market.field = localConfig.UString("colors.market.field") | ||
settings.colors.market.value = localConfig.UString("colors.market.value") | ||
|
||
summaryMap, _ := ymlConfig.Map("summary") | ||
settings.summary = summaryMap | ||
|
||
return &settings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters