updated config and added tls support
This commit is contained in:
+8
-1
@@ -1,3 +1,10 @@
|
||||
USERS_FILE=users.json
|
||||
USERS_DB=users.db
|
||||
ENABLE_SELF_REGISTER=false
|
||||
ENABLE_SELF_REGISTER=false
|
||||
|
||||
ENABLE_TLS=false
|
||||
CERT_FILE=/home/tola/certs/localhost/localhost.crt
|
||||
KEY_FILE=/home/tola/certs/localhost/localhost.key
|
||||
|
||||
SERVER_ADDRESS=localhost
|
||||
SERVER_PORT=8090
|
||||
@@ -39,5 +39,17 @@ func main() {
|
||||
http.HandleFunc("/api/users/change", users.ChangeUser)
|
||||
http.HandleFunc("/api/users/del", users.DelUser)
|
||||
http.HandleFunc("/api/users/add", users.AddUser)
|
||||
http.ListenAndServe(":8090", nil)
|
||||
if os.Getenv("ENABLE_TLS") == "true" {
|
||||
http.ListenAndServeTLS(
|
||||
os.Getenv("SERVER_ADDRESS")+":"+os.Getenv("SERVER_PORT"),
|
||||
os.Getenv("CERT_FILE"),
|
||||
os.Getenv("KEY_FILE"),
|
||||
nil,
|
||||
)
|
||||
} else {
|
||||
http.ListenAndServe(
|
||||
os.Getenv("SERVER_ADDRESS")+":"+os.Getenv("SERVER_PORT"),
|
||||
nil,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user