How to retrieve SHH Port (server settings) in plugin code?

Hi,

Seems neither ApplicationPropertiesService nor ApplicationProperties contain SSH Port, which is visible on /bitbucket/admin/server-settings page. Does anyone know if there is a way to retrieve it in Bitbucket plugin?

Thanks,
Viktor

The SSH port can be retrieved using SshConfigurationService.getConfiguration().getPort(). But if you’re looking for the SSH clone URL for a repository, you can use RepositoryService.getCloneLinks instead.

If you’re going to use SshConfigurationService, make sure to add a dependency on bitbucket-ssh-api in your pom.xml

Cheers,
Michael

RepositoryService#getCloneLinks() is exactly what I was re-inventing :wink: