mirror of
https://github.com/PretendoNetwork/friends.git
synced 2026-03-21 18:04:11 -05:00
feat: add basic health check server
This commit is contained in:
parent
803ccf46b5
commit
6fee83c989
25
README.md
25
README.md
|
|
@ -84,15 +84,16 @@ All configuration options are handled via environment variables
|
|||
|
||||
`.env` files are supported
|
||||
|
||||
| Name | Description | Required |
|
||||
|---------------------------------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
|
||||
| `PN_FRIENDS_CONFIG_DATABASE_URI` | Fully qualified URI to your Postgres server (Example `postgres://username:password@localhost/friends?sslmode=disable`) | Yes |
|
||||
| `PN_FRIENDS_CONFIG_AES_KEY` | AES key used in tokens provided by the account server | Yes |
|
||||
| `PN_FRIENDS_CONFIG_GRPC_API_KEY` | API key for your GRPC server | No (Assumed to be an open gRPC API) |
|
||||
| `PN_FRIENDS_GRPC_SERVER_PORT` | Port for the GRPC server | Yes |
|
||||
| `PN_FRIENDS_AUTHENTICATION_SERVER_PORT` | Port for the authentication server | Yes |
|
||||
| `PN_FRIENDS_SECURE_SERVER_HOST` | Host name for the secure server (should point to the same address as the authentication server) | Yes |
|
||||
| `PN_FRIENDS_SECURE_SERVER_PORT` | Port for the secure server | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_HOST` | Host name for your account server gRPC service | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_PORT` | Port for your account server gRPC service | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_API_KEY` | API key for your account server gRPC service | No (Assumed to be an open gRPC API) |
|
||||
| Name | Description | Required |
|
||||
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| `PN_FRIENDS_CONFIG_DATABASE_URI` | Fully qualified URI to your Postgres server (Example `postgres://username:password@localhost/friends?sslmode=disable`) | Yes |
|
||||
| `PN_FRIENDS_CONFIG_AES_KEY` | AES key used in tokens provided by the account server | Yes |
|
||||
| `PN_FRIENDS_CONFIG_GRPC_API_KEY` | API key for your GRPC server | No (Assumed to be an open gRPC API) |
|
||||
| `PN_FRIENDS_GRPC_SERVER_PORT` | Port for the GRPC server | Yes |
|
||||
| `PN_FRIENDS_AUTHENTICATION_SERVER_PORT` | Port for the authentication server | Yes |
|
||||
| `PN_FRIENDS_SECURE_SERVER_HOST` | Host name for the secure server (should point to the same address as the authentication server) | Yes |
|
||||
| `PN_FRIENDS_SECURE_SERVER_PORT` | Port for the secure server | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_HOST` | Host name for your account server gRPC service | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_PORT` | Port for your account server gRPC service | Yes |
|
||||
| `PN_FRIENDS_ACCOUNT_GRPC_API_KEY` | API key for your account server gRPC service | No (Assumed to be an open gRPC API) |
|
||||
| `PN_FRIENDS_CONFIG_HEALTH_CHECK_PORT` | Port for the basic UDP health check server | No |
|
||||
|
|
|
|||
|
|
@ -11,7 +11,13 @@ import (
|
|||
var serverBuildString string
|
||||
|
||||
func StartAuthenticationServer() {
|
||||
port, _ := strconv.Atoi(os.Getenv("PN_FRIENDS_AUTHENTICATION_SERVER_PORT"))
|
||||
prudpPort, _ := strconv.Atoi(os.Getenv("PN_FRIENDS_AUTHENTICATION_SERVER_PORT"))
|
||||
|
||||
healthCheckPortString := os.Getenv("PN_FRIENDS_CONFIG_HEALTH_CHECK_PORT")
|
||||
if healthCheckPortString != "" {
|
||||
healthCheckPort, _ := strconv.Atoi(healthCheckPortString)
|
||||
go nex.EnableBasicUDPHealthCheck(healthCheckPort)
|
||||
}
|
||||
|
||||
globals.AuthenticationServer = nex.NewPRUDPServer()
|
||||
globals.AuthenticationEndpoint = nex.NewPRUDPEndPoint(1)
|
||||
|
|
@ -27,5 +33,5 @@ func StartAuthenticationServer() {
|
|||
globals.AuthenticationServer.SessionKeyLength = 16
|
||||
globals.AuthenticationServer.AccessKey = "ridfebb9"
|
||||
globals.AuthenticationServer.BindPRUDPEndPoint(globals.AuthenticationEndpoint)
|
||||
globals.AuthenticationServer.Listen(port)
|
||||
globals.AuthenticationServer.Listen(prudpPort)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user