diff --git a/src/janus.c b/src/janus.c index 7013255a33..f0153d27da 100644 --- a/src/janus.c +++ b/src/janus.c @@ -4421,6 +4421,11 @@ gint main(int argc, char *argv[]) { if(!janus_options_parse(&options, argc, argv)) exit(1); + if(options.print_version) { + janus_options_destroy(); + exit(0); + } + /* Any configuration to open? */ if(options.config_file) { config_file = g_strdup(options.config_file); diff --git a/src/options.c b/src/options.c index 4c67dabe2b..7def7168a6 100644 --- a/src/options.c +++ b/src/options.c @@ -56,6 +56,7 @@ gboolean janus_options_parse(janus_options *options, int argc, char *argv[]) { { "token-auth-secret", 0, 0, G_OPTION_ARG_STRING, &options->token_auth_secret, "Secret to verify HMAC-signed tokens with, to be used with -A", "randomstring" }, { "event-handlers", 'e', 0, G_OPTION_ARG_NONE, &options->event_handlers, "Enable event handlers", NULL }, { "no-webrtc-encryption", 'w', 0, G_OPTION_ARG_NONE, &options->no_webrtc_encryption, "Disable WebRTC encryption, so no DTLS or SRTP (only for debugging!)", NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &options->print_version, "Print version and exit", NULL }, { NULL, 0, 0, 0, NULL, NULL, NULL }, }; diff --git a/src/options.h b/src/options.h index fbe5e6526a..63986c09b0 100644 --- a/src/options.h +++ b/src/options.h @@ -56,6 +56,7 @@ typedef struct janus_options { const char *token_auth_secret; gboolean event_handlers; gboolean no_webrtc_encryption; + gboolean print_version; } janus_options; /*! \brief Helper method to parse the command line options