Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#292] Provide application version as a numeric value too #293

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ add_compile_options(-D_GNU_SOURCE)
add_compile_options(-Wno-deprecated)
add_compile_options(-Wno-deprecated-declarations)

#
# version number and string representation
# the numeric value is computed as
# patch + minor * 1000 + major * 10000
#
add_compile_options(-DPGAGROAL_VERSION="1.5.0")
add_compile_options(-DPGAGROAL_VERSION_NUM=15000)


set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
Expand Down
4 changes: 2 additions & 2 deletions src/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ static char* generate_password(int pwd_length);
static void
version(void)
{
printf("pgagroal-admin %s\n", VERSION);
printf("pgagroal-admin %s\n", PGAGROAL_VERSION);
exit(1);
}

static void
usage(void)
{
printf("pgagroal-admin %s\n", VERSION);
printf("pgagroal-admin %s\n", PGAGROAL_VERSION);
printf(" Administration utility for pgagroal\n");
printf("\n");

Expand Down
4 changes: 2 additions & 2 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ static int reload(SSL* ssl, int socket);
static void
version(void)
{
printf("pgagroal-cli %s\n", VERSION);
printf("pgagroal-cli %s\n", PGAGROAL_VERSION);
exit(1);
}

static void
usage(void)
{
printf("pgagroal-cli %s\n", VERSION);
printf("pgagroal-cli %s\n", PGAGROAL_VERSION);
printf(" Command line utility for pgagroal\n");
printf("\n");

Expand Down
2 changes: 0 additions & 2 deletions src/include/pgagroal.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ extern "C" {
#include <sys/types.h>
#include <openssl/ssl.h>

#define VERSION "1.5.0"

#define PGAGROAL_HOMEPAGE "https://agroal.github.io/pgagroal/"
#define PGAGROAL_ISSUES "https://github.com/agroal/pgagroal/issues"

Expand Down
6 changes: 3 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ shutdown_management(void)
static void
version(void)
{
printf("pgagroal %s\n", VERSION);
printf("pgagroal %s\n", PGAGROAL_VERSION);
exit(1);
}

static void
usage(void)
{
printf("pgagroal %s\n", VERSION);
printf("pgagroal %s\n", PGAGROAL_VERSION);
printf(" High-performance connection pool for PostgreSQL\n");
printf("\n");

Expand Down Expand Up @@ -1039,7 +1039,7 @@ main(int argc, char** argv)
start_management();
}

pgagroal_log_info("pgagroal: started on %s:%d", config->host, config->port);
pgagroal_log_info("pgagroal: v%s started on %s:%d", PGAGROAL_VERSION, config->host, config->port);
for (int i = 0; i < main_fds_length; i++)
{
pgagroal_log_debug("Socket: %d", *(main_fds + i));
Expand Down