Add HTTP port to config file

This commit is contained in:
Chteufleur 2016-06-20 19:20:13 +02:00
parent b9f3db7998
commit df795bf0ce
5 changed files with 132 additions and 132 deletions

View File

@ -22,7 +22,7 @@ const (
TRANSACTION_ID = "transaction_id"
ROUTE_ROOT = "/"
ROUTE_AUTH = "/toto"
ROUTE_AUTH = "/auth"
RETURN_VALUE_OK = "OK"
RETURN_VALUE_NOK = "NOK"
@ -35,7 +35,6 @@ var (
TimeoutSec = 60
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
// TODO
fmt.Fprintf(w, "Welcome to HTTP authentification over XMPP")
@ -66,8 +65,6 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
}
}
func Run() {
log.Printf("%sRunning", LogInfo)

View File

@ -4,3 +4,5 @@ xmpp_server_port=5347
xmpp_hostname=xmppsteam.kingpenguin.tk
xmpp_secret=xmpp4steam_password
xmpp_debug=true
http_port=9090

View File

@ -35,6 +35,11 @@ func init() {
log.Println("Define HTTP timeout to %d second", httpTimeout)
http.TimeoutSec = httpTimeout
}
httpPort, err := strconv.Atoi(mapConfig["http_port"])
if err == nil {
log.Println("Define HTTP port to %d", httpPort)
http.HttpPortBind = httpPort
}
// XMPP config
xmpp.Addr = mapConfig["xmpp_server_address"] + ":" + mapConfig["xmpp_server_port"]
@ -43,7 +48,6 @@ func init() {
xmpp.Debug = mapConfig["xmpp_debug"] == "true"
}
func request() {
for {
client := new(xmpp.Client)

View File

@ -16,7 +16,6 @@ type Client struct {
ChanReply chan bool
}
func (client *Client) QueryClient() {
log.Printf("%sQuery JID %s", LogInfo, client.JID)
clientJID, _ := xmpp.ParseJID(client.JID)

View File

@ -32,8 +32,6 @@ var (
Debug = true
)
func Run() {
log.Printf("%sRunning", LogInfo)
// Create stream and configure it as a component connection.