forked from oldfritter/goDCE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16529a5
commit 620ad5d
Showing
25 changed files
with
237 additions
and
301 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package config | ||
|
||
import ( | ||
"io/ioutil" | ||
"log" | ||
"path/filepath" | ||
|
||
"github.com/oldfritter/sneaker-go/v3" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
var ( | ||
RabbitMqConnect sneaker.RabbitMqConnect | ||
) | ||
|
||
var AmqpGlobalConfig struct { | ||
Connect struct { | ||
Host string `yaml:"host"` | ||
Port string `yaml:"port"` | ||
Username string `yaml:"username"` | ||
Password string `yaml:"password"` | ||
Vhost string `yaml:"vhost"` | ||
} `yaml:"connect"` | ||
|
||
Exchange map[string]map[string]string `yaml:"exchange"` | ||
Queue map[string]map[string]string `yaml:"queue"` | ||
} | ||
|
||
func InitAmqpConfig() { | ||
pathStr, _ := filepath.Abs("config/amqp.yml") | ||
content, err := ioutil.ReadFile(pathStr) | ||
if err != nil { | ||
log.Fatal(err) | ||
return | ||
} | ||
err = yaml.Unmarshal(content, &AmqpGlobalConfig) | ||
if err != nil { | ||
log.Fatal(err) | ||
return | ||
} | ||
} |
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,10 @@ | ||
package config | ||
|
||
import ( | ||
sneaker "github.com/oldfritter/sneaker-go/v3" | ||
) | ||
|
||
var ( | ||
AllWorkers []sneaker.Worker | ||
AllWorkerIs []sneaker.WorkerI | ||
) |
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
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,25 @@ | ||
package initializers | ||
|
||
import ( | ||
"io/ioutil" | ||
"log" | ||
"path/filepath" | ||
|
||
"gopkg.in/yaml.v2" | ||
|
||
"github.com/oldfritter/goDCE/config" | ||
"github.com/oldfritter/goDCE/workers/sneakerWorkers" | ||
) | ||
|
||
func InitWorkers() { | ||
pathStr, _ := filepath.Abs("config/workers.yml") | ||
content, err := ioutil.ReadFile(pathStr) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
yaml.Unmarshal(content, &config.AllWorkers) | ||
sneakerWorkers.InitializeKLineWorker() | ||
sneakerWorkers.InitializeTickerWorker() | ||
sneakerWorkers.InitializeRebuildKLineToRedisWorker() | ||
sneakerWorkers.InitializeAccountVersionCheckPointWorker() | ||
} |
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
Oops, something went wrong.