[PR #1970] [CLOSED] feat: add flag for specifying port number #10742

Closed
opened 2026-04-12 23:09:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/1970
Author: @P3rtang
Created: 1/12/2024
Status: Closed

Base: mainHead: port-flag


📝 Commits (1)

  • 61cd7dc feat: add flag for specifying port number

📊 Changes

4 files changed (+41 additions, -17 deletions)

View changed files

📝 api/client.go (+6 -1)
📝 api/client_test.go (+4 -2)
📝 cmd/cmd.go (+29 -12)
📝 cmd/interactive.go (+2 -2)

📄 Description

I haven't opened an issue about this since it is already possible to change to default port ollama uses with an env variable.
But it would be more convenient in my opinion to have the port a flag as well. Mostly because I often end up running two instances of ollama, one with gpu acceleration and one without.

The thing I'm most unsure about is having to modify the ClientFromEnvironment function to accept the cobra cmd to get out the port flag variable (this might be the very reason it's done only via the env variable)

This is more of a concept pull request and would love an opinion on this idea


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/1970 **Author:** [@P3rtang](https://github.com/P3rtang) **Created:** 1/12/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `port-flag` --- ### 📝 Commits (1) - [`61cd7dc`](https://github.com/ollama/ollama/commit/61cd7dc6aa94d61b1d4277347c42a4d195701610) feat: add flag for specifying port number ### 📊 Changes **4 files changed** (+41 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+6 -1) 📝 `api/client_test.go` (+4 -2) 📝 `cmd/cmd.go` (+29 -12) 📝 `cmd/interactive.go` (+2 -2) </details> ### 📄 Description I haven't opened an issue about this since it is already possible to change to default port ollama uses with an env variable. But it would be more convenient in my opinion to have the port a flag as well. Mostly because I often end up running two instances of ollama, one with gpu acceleration and one without. The thing I'm most unsure about is having to modify the ```ClientFromEnvironment``` function to accept the cobra cmd to get out the port flag variable (this might be the very reason it's done only via the env variable) This is more of a concept pull request and would love an opinion on this idea --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:09:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#10742