diff --git a/README.md b/README.md index 034526c..35a06ae 100644 --- a/README.md +++ b/README.md @@ -273,46 +273,46 @@ To see all the available options run `flight_sql --help`. ```bash flight_sql --help Allowed options: - --help produce this help message - -B [ --backend ] arg (=duckdb) Specify the database backend. Allowed - options: duckdb, sqlite. - -H [ --hostname ] arg Specify the hostname to listen on for - the Flight SQL Server. If not set, we - will use env var: 'FLIGHT_HOSTNAME'.If - that isn't set, we will use the default - of: '0.0.0.0'. - -R [ --port ] arg (=31337) Specify the port to listen on for the - Flight SQL Server. - -D [ --database-filename ] arg Specify the database filename (absolute - or relative to the current working - directory) - -U [ --username ] arg (=flight_username) - Specify the username to allow to - connect to the Flight SQL Server for - clients. - -P [ --password ] arg Specify the password to set on the - Flight SQL Server for clients to - connect with. If not set, we will use - env var: 'FLIGHT_PASSWORD'.If that - isn't set, the server will exit with - failure. - -S [ --secret-key ] arg Specify the secret key used to sign - JWTs issued by the Flight SQL Server. - If it isn't set, we use env var: - 'SECRET_KEY'. If that isn't set, the - server will create a random secret key. - -T [ --tls ] arg Specify the TLS certificate and key - file paths. - -I [ --init-sql-commands ] arg Specify the SQL commands to run on - server startup.If not set, we will use - env var: 'INIT_SQL_COMMANDS'. - -F [ --init-sql-commands-file ] arg Specify a file containing SQL commands - to run on server startup.If not set, we - will use env var: 'INIT_SQL_COMMANDS_FI - LE'. - -M [ --mtls-ca-cert-filename ] arg Specify an optional mTLS CA certificate - path used to verify clients. The - certificate MUST be in PEM format. - -Q [ --print-queries ] Print queries run by clients to stdout + --help produce this help message + -B [ --backend ] arg (=duckdb) Specify the database backend. Allowed + options: duckdb, sqlite. + -H [ --hostname ] arg Specify the hostname to listen on for the + Flight SQL Server. If not set, we will + use env var: 'FLIGHT_HOSTNAME'. If that + isn't set, we will use the default of: + '0.0.0.0'. + -R [ --port ] arg (=31337) Specify the port to listen on for the + Flight SQL Server. + -D [ --database-filename ] arg Specify the database filename (absolute + or relative to the current working + directory) + -U [ --username ] arg Specify the username to allow to connect + to the Flight SQL Server for clients. If + not set, we will use env var: + 'FLIGHT_USERNAME'. If that isn't set, we + will use the default of: + 'flight_username'. + -P [ --password ] arg Specify the password to set on the Flight + SQL Server for clients to connect with. + If not set, we will use env var: + 'FLIGHT_PASSWORD'. If that isn't set, + the server will exit with failure. + -S [ --secret-key ] arg Specify the secret key used to sign JWTs + issued by the Flight SQL Server. If it + isn't set, we use env var: 'SECRET_KEY'. + If that isn't set, the server will create + a random secret key. + -T [ --tls ] arg Specify the TLS certificate and key file + paths. + -I [ --init-sql-commands ] arg Specify the SQL commands to run on server + startup. If not set, we will use env + var: 'INIT_SQL_COMMANDS'. + -F [ --init-sql-commands-file ] arg Specify a file containing SQL commands to + run on server startup. If not set, we + will use env var: 'INIT_SQL_COMMANDS_FILE + '. + -M [ --mtls-ca-cert-filename ] arg Specify an optional mTLS CA certificate + path used to verify clients. The + certificate MUST be in PEM format. + -Q [ --print-queries ] Print queries run by clients to stdout ``` - diff --git a/src/flight_sql.cpp b/src/flight_sql.cpp index 27636f9..79b2760 100644 --- a/src/flight_sql.cpp +++ b/src/flight_sql.cpp @@ -21,8 +21,9 @@ int main(int argc, char **argv) { "Specify the port to listen on for the Flight SQL Server.") ("database-filename,D", po::value()->default_value(""), "Specify the database filename (absolute or relative to the current working directory)") - ("username,U", po::value()->default_value("flight_username"), - "Specify the username to allow to connect to the Flight SQL Server for clients.") + ("username,U", po::value()->default_value(""), + "Specify the username to allow to connect to the Flight SQL Server for clients. If not set, we will use env var: 'FLIGHT_USERNAME'. " + "If that isn't set, we will use the default of: 'flight_username'.") ("password,P", po::value()->default_value(""), "Specify the password to set on the Flight SQL Server for clients to connect with. If not set, we will use env var: 'FLIGHT_PASSWORD'. " "If that isn't set, the server will exit with failure.") diff --git a/src/library/flight_sql_library.cpp b/src/library/flight_sql_library.cpp index fecac62..b97025e 100644 --- a/src/library/flight_sql_library.cpp +++ b/src/library/flight_sql_library.cpp @@ -172,7 +172,8 @@ arrow::Result> CreateFl if (username.empty()) { username = SafeGetEnvVarValue("FLIGHT_USERNAME"); if (username.empty()) { - username = "flight_username"; + username = DEFAULT_FLIGHT_USERNAME; + } } if (password.empty()) { diff --git a/src/library/include/flight_sql_library.h b/src/library/include/flight_sql_library.h index b234f07..954c800 100644 --- a/src/library/include/flight_sql_library.h +++ b/src/library/include/flight_sql_library.h @@ -5,6 +5,7 @@ // Constants const std::string DEFAULT_FLIGHT_HOSTNAME = "0.0.0.0"; +const std::string DEFAULT_FLIGHT_USERNAME = "flight_username"; const int DEFAULT_FLIGHT_PORT = 31337; enum class BackendType {