Skip to content

Commit fabde3b

Browse files
authored
arg: Add comment line support to --api-key-file (ggml-org#23168)
1 parent 0d2d9cc commit fabde3b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

common/arg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,15 +2911,15 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
29112911
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_API_KEY"));
29122912
add_opt(common_arg(
29132913
{"--api-key-file"}, "FNAME",
2914-
"path to file containing API keys (default: none)",
2914+
"path to file containing API keys, one per line; lines starting with a hash are treated as comments (default: none)",
29152915
[](common_params & params, const std::string & value) {
29162916
std::ifstream key_file(value);
29172917
if (!key_file) {
29182918
throw std::runtime_error(string_format("error: failed to open file '%s'\n", value.c_str()));
29192919
}
29202920
std::string key;
29212921
while (std::getline(key_file, key)) {
2922-
if (!key.empty()) {
2922+
if (!key.empty() && key[0] != '#') {
29232923
params.api_keys.push_back(key);
29242924
}
29252925
}

tools/server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ For the full list of features, please refer to [server's changelog](https://gith
198198
| `--embedding, --embeddings` | restrict to only support embedding use case; use only with dedicated embedding models (default: disabled)<br/>(env: LLAMA_ARG_EMBEDDINGS) |
199199
| `--rerank, --reranking` | enable reranking endpoint on server (default: disabled)<br/>(env: LLAMA_ARG_RERANKING) |
200200
| `--api-key KEY` | API key to use for authentication, multiple keys can be provided as a comma-separated list (default: none)<br/>(env: LLAMA_API_KEY) |
201-
| `--api-key-file FNAME` | path to file containing API keys (default: none)<br/>(env: LLAMA_ARG_API_KEY_FILE) |
201+
| `--api-key-file FNAME` | path to file containing API keys, one per line; lines starting with a hash are treated as comments (default: none)<br/>(env: LLAMA_ARG_API_KEY_FILE) |
202202
| `--ssl-key-file FNAME` | path to file a PEM-encoded SSL private key<br/>(env: LLAMA_ARG_SSL_KEY_FILE) |
203203
| `--ssl-cert-file FNAME` | path to file a PEM-encoded SSL certificate<br/>(env: LLAMA_ARG_SSL_CERT_FILE) |
204204
| `--chat-template-kwargs STRING` | sets additional params for the json template parser, must be a valid json object string, e.g. '{"key1":"value1","key2":"value2"}'<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_KWARGS) |

0 commit comments

Comments
 (0)