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

Configure gt using custom host and port #236

Closed
a-b opened this issue Sep 21, 2023 · 4 comments · Fixed by #262
Closed

Configure gt using custom host and port #236

a-b opened this issue Sep 21, 2023 · 4 comments · Fixed by #262
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs

Comments

@a-b
Copy link

a-b commented Sep 21, 2023

I'm running seagoat-server in the cloud and want to configure gt to use an external host and port instead of http://0.0.0.0:35257. Please consider adding this feature.

@kantord
Copy link
Owner

kantord commented Sep 22, 2023

I would definitely want to add this feature. Actually if you need it urgently, or you would like to contribute you, feel free to create a pull request. I can help you get it merged asap.

It's not so complicated to do this as this only affects the CLI.

I am explaining here how to implement it to make it easy for you. As a first step you can add a new flag/option to supply the remote server URL:

SeaGOAT/seagoat/cli.py

Lines 68 to 107 in 4b6e74a

@click.command()
@click.argument("query")
@click.argument("repo_path", required=False, default=os.getcwd())
@click.option(
"--no-color",
is_flag=True,
help="Disable formatting. Automatically enabled when part of a bash pipeline.",
)
@click.option(
"-l",
"--max-results",
type=int,
default=None,
help="Limit the number of result lines",
)
@click.option(
"-B",
"--context-above",
type=int,
default=None,
help="Include this many lines of context before each result",
)
@click.option(
"-A",
"--context-below",
type=int,
default=None,
help="Include this many lines of context after each result",
)
@click.option(
"-C",
"--context",
type=int,
default=None,
help="Include this many lines of context after and before each result",
)
@click.version_option(version=__version__, prog_name="seagoat")
def seagoat(
query, repo_path, no_color, max_results, context_above, context_below, context
):

then, you just need to make sure that that argument is used instead of getting the server info here:

SeaGOAT/seagoat/cli.py

Lines 120 to 121 in 4b6e74a

server_info = get_server_info(repo_path)
server_address = server_info["address"]

A further improvement could be to create support for config files, and then in those config files there could be a configuration option to match a local folder with a remote server URL so that it always uses the remote server by default.

@kantord
Copy link
Owner

kantord commented Sep 22, 2023

I am adding good first issue on this one as well, as a releasable implementation can be created without knowledge of the project structure using the information I shared above. Also testing should be easy, you can take inspiration in test_cli.py.

@kantord kantord added good first issue Good for newcomers up for grabs enhancement New feature or request labels Sep 22, 2023
@kantord
Copy link
Owner

kantord commented Sep 22, 2023

I would also like to note that it should be possible to create a feature that allows local users to import data from a remote server to avoid having to analyze the entire repository locally. Actually you should already be able to do this manually by simply copying the cache folder from the server to the local machine. This would have the added benefit that the users are still able to search their local changes, and even when they are not connected to the internet. And it should also be faster by saving the network overhead

Also I am working on creating a web-based GUI as well, using that your users will be able to search your repositories using SeaGOAT without installing anything on their computer: https://github.com/kantord/SeaGOAT-web

@kantord
Copy link
Owner

kantord commented Sep 26, 2023

Now that configuration files are supported, this should be even more trivial to implement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants