Skip to content

Commit

Permalink
Merge pull request #47 from EOSIO/update-config-listen
Browse files Browse the repository at this point in the history
Move the configuration endpoint to its own port.
  • Loading branch information
ericiles authored Aug 14, 2018
2 parents 2014c31 + 58316fc commit 83199a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TUTORIAL-ADVANCED.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ User -/-> Proxy

#### Proxy

For this layer, we are proxying requests through HAProxy. At this point, we terminate SSL, and then route the request to the filter layer.
For this layer, we are proxying requests through HAProxy. At this point, we terminate SSL, and then route the request to the filter layer. *Note* HAProxy should not expose the port that the configuration is exposed on.

The proxy runs Patroneos in log mode (listens for rule violations from the filter(s), and logs them to a log file.

Expand Down
1 change: 1 addition & 0 deletions example-configs/advanced/fail2ban-relay-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{

"listenIP": "",
"configListenPort": "9000",
"listenPort": "8080",

"nodeosProtocol": "http",
Expand Down
1 change: 1 addition & 0 deletions example-configs/advanced/filter-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"listenIP": "",
"configListenPort": "9001",
"listenPort": "8081",

"nodeosProtocol": "http",
Expand Down
1 change: 1 addition & 0 deletions example-configs/simple/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"listenIP": "",
"configListenPort": "9000",
"listenPort": "8080",

"nodeosProtocol": "http",
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// Config defines the application configuration
type Config struct {
ListenIP string `json:"listenIP"`
ConfigListenPort string `json:"configListenPort"`
ListenPort string `json:"listenPort"`
NodeosProtocol string `json:"nodeosProtocol"`
NodeosURL string `json:"nodeosUrl"`
Expand Down Expand Up @@ -129,7 +130,6 @@ func main() {
parseConfigFile()

mux := http.NewServeMux()
mux.HandleFunc("/patroneos/config", updateConfig)

if operatingMode == "filter" {
addFilterHandlers(mux)
Expand All @@ -142,5 +142,11 @@ func main() {
os.Exit(1)
}

go func() {
configMux := http.NewServeMux()
configMux.HandleFunc("/patroneos/config", updateConfig)
log.Fatal(http.ListenAndServe(appConfig.ListenIP+":"+appConfig.ConfigListenPort, configMux))
}()

log.Fatal(http.ListenAndServe(appConfig.ListenIP+":"+appConfig.ListenPort, mux))
}

0 comments on commit 83199a6

Please sign in to comment.