updated config and added tls support
This commit is contained in:
1 parent
6375fc028e
commit
1080c8fcd9
2 files changed
+21
-2
No files matched your search
+8
-1
@@ -1,3 +1,10 @@
|
|||||||
USERS_FILE=users.json
|
USERS_FILE=users.json
|
||||||
USERS_DB=users.db
|
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/change", users.ChangeUser)
|
||||||
http.HandleFunc("/api/users/del", users.DelUser)
|
http.HandleFunc("/api/users/del", users.DelUser)
|
||||||
http.HandleFunc("/api/users/add", users.AddUser)
|
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