From 4d164b6616198ca0dba139f42a2baf1eeca47b72 Mon Sep 17 00:00:00 2001 From: Suhaib Date: Sat, 12 Oct 2024 21:37:42 -0700 Subject: [PATCH] Some fixes and updates to readme and docker --- README.md | 14 ++++++++++---- config/configuration.go | 4 ++-- main.go | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0f25cd3..9244520 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,18 @@ To run SMQ, execute the built binary: ./smq ``` -SMQ will start running on port 80097 by default. However, you can customize the behavior of SMQ using command-line flags and environment variables. The priority for these settings is as follows: command-line flags > environment variables > default values. +SMQ will start running on port 8097 by default. However, you can customize the behavior of SMQ using command-line flags and environment variables. The priority for these settings is as follows: command-line flags > environment variables > default values. + +### Using Docker + +```bash +docker run suhaibinator/smq:latest +``` ### Command-Line Flags -- `--dbpath`: Specifies the path to the SQLite database file. By default, it is set to `/db/dbtest.db`. -- `--port`: Specifies the port to listen on. By default, it is set to `80097`. +- `--dbpath`: Specifies the path to the SQLite database file. By default, it is set to `./dbtest.db`. +- `--port`: Specifies the port to listen on. By default, it is set to `8097`. If command-line flags are provided, they take the highest priority and override any other settings. @@ -84,7 +90,7 @@ import ( func main() { // Create a new client - smqClient, err := client.NewClient("localhost", "80097") + smqClient, err := client.NewClient("localhost", "8097") if err != nil { log.Fatalf("Failed to create client: %v", err) } diff --git a/config/configuration.go b/config/configuration.go index 4447eae..ca04b5d 100644 --- a/config/configuration.go +++ b/config/configuration.go @@ -7,6 +7,6 @@ const ( var ( // DBPath is the path to the SQLite database file - DBPath = "/db/dbtest.db" - Port = "80097" + DBPath = "./dbtest.db" + Port = "8097" ) diff --git a/main.go b/main.go index b013684..4496e3a 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "os" "github.com/Suhaibinator/SuhaibMessageQueue/config" + "github.com/Suhaibinator/SuhaibMessageQueue/server" ) func init() { @@ -35,4 +36,7 @@ func init() { } func main() { + // Start the server + server := server.NewServer(config.Port, config.DBPath) + server.Start() }