Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brianip/configure agent api port #94

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/orchestrator.conf.json.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Debug": true,
"ListenAddress": ":3000",
"AgentsServerPort": ":3001",
"MySQLTopologyUser": "msandbox",
"MySQLTopologyPassword": "msandbox",
"MySQLTopologyCredentialsConfigFile": "",
Expand Down
15 changes: 8 additions & 7 deletions go/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
package app

import (
nethttp "net/http"
"os"
"os/signal"
"strings"
"syscall"

"github.com/go-martini/martini"
"github.com/martini-contrib/auth"
"github.com/martini-contrib/gzip"
Expand All @@ -27,11 +33,6 @@ import (
"github.com/outbrain/orchestrator/go/http"
"github.com/outbrain/orchestrator/go/inst"
"github.com/outbrain/orchestrator/go/logic"
nethttp "net/http"
"os"
"os/signal"
"strings"
"syscall"
)

// acceptSignals registers for OS signals
Expand Down Expand Up @@ -138,11 +139,11 @@ func agentsHttp() {
// Serve
if config.Config.AgentsUseSSL {
log.Info("Serving via SSL")
err := nethttp.ListenAndServeTLS(":3001", config.Config.SSLCertFile, config.Config.SSLPrivateKeyFile, m)
err := nethttp.ListenAndServeTLS(config.Config.AgentsServerPort, config.Config.SSLCertFile, config.Config.SSLPrivateKeyFile, m)
if err != nil {
log.Fatale(err)
}
} else {
nethttp.ListenAndServe(":3001", m)
nethttp.ListenAndServe(config.Config.AgentsServerPort, m)
}
}
5 changes: 4 additions & 1 deletion go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package config

import (
"code.google.com/p/gcfg"
"encoding/json"
"os"

"code.google.com/p/gcfg"

"github.com/outbrain/golib/log"
)

Expand All @@ -30,6 +31,7 @@ import (
type Configuration struct {
Debug bool // set debug mode (similar to --debug option)
ListenAddress string
AgentsServerPort string // port orchestrator agents talk back to
MySQLTopologyUser string
MySQLTopologyPassword string // my.cnf style configuration file from where to pick credentials. Expecting `user`, `password` under `[client]` section
MySQLTopologyCredentialsConfigFile string
Expand Down Expand Up @@ -114,6 +116,7 @@ func NewConfiguration() *Configuration {
return &Configuration{
Debug: false,
ListenAddress: ":3000",
AgentsServerPort: ":3001",
MySQLOrchestratorPort: 3306,
MySQLTopologyMaxPoolConnections: 3,
MySQLConnectTimeoutSeconds: 5,
Expand Down