diff --git a/app/gitspace/orchestrator/ide/jetbrains.go b/app/gitspace/orchestrator/ide/jetbrains.go index 9341e4772..b915607c9 100644 --- a/app/gitspace/orchestrator/ide/jetbrains.go +++ b/app/gitspace/orchestrator/ide/jetbrains.go @@ -38,7 +38,14 @@ const ( ) type JetBrainsIDEConfig struct { - Port int + IntelliJPort int + GolandPort int + PyCharmPort int + WebStormPort int + CLionPort int + PHPStormPort int + RubyMinePort int + RiderPort int } type JetBrainsIDE struct { @@ -53,6 +60,35 @@ func NewJetBrainsIDEService(config *JetBrainsIDEConfig, ideType enum.IDEType) *J } } +func (jb *JetBrainsIDE) port() int { + switch jb.ideType { + case enum.IDETypeIntelliJ: + return jb.config.IntelliJPort + case enum.IDETypeGoland: + return jb.config.GolandPort + case enum.IDETypePyCharm: + return jb.config.PyCharmPort + case enum.IDETypeWebStorm: + return jb.config.WebStormPort + case enum.IDETypeCLion: + return jb.config.CLionPort + case enum.IDETypePHPStorm: + return jb.config.PHPStormPort + case enum.IDETypeRubyMine: + return jb.config.RubyMinePort + case enum.IDETypeRider: + return jb.config.RiderPort + case enum.IDETypeVSCode: + // IDETypeVSCode is not JetBrainsIDE + return 0 + case enum.IDETypeVSCodeWeb: + // IDETypeVSCodeWeb is not JetBrainsIDE + return 0 + default: + return 0 + } +} + // Setup installs the SSH server inside the container. func (jb *JetBrainsIDE) Setup( ctx context.Context, @@ -178,7 +214,7 @@ func (jb *JetBrainsIDE) runSSHServer( gitspaceLogger gitspaceTypes.GitspaceLogger, ) error { payload := gitspaceTypes.RunSSHServerPayload{ - Port: strconv.Itoa(jb.config.Port), + Port: strconv.Itoa(jb.port()), } runSSHScript, err := utils.GenerateScriptFromTemplate( templateRunSSHServer, &payload) @@ -237,7 +273,7 @@ func (jb *JetBrainsIDE) runRemoteIDE( // Port returns the port on which the ssh-server is listening. func (jb *JetBrainsIDE) Port() *types.GitspacePort { return &types.GitspacePort{ - Port: jb.config.Port, + Port: jb.port(), Protocol: enum.CommunicationProtocolSSH, } } diff --git a/cli/operations/server/config.go b/cli/operations/server/config.go index 9bf96847a..63e4bb176 100644 --- a/cli/operations/server/config.go +++ b/cli/operations/server/config.go @@ -442,10 +442,16 @@ func ProvideIDEVSCodeConfig(config *types.Config) *ide.VSCodeConfig { } } -// ProvideIDEIntellijConfig loads the IdeType IDE config from the main config. -func ProvideIDEIntellijConfig(config *types.Config) *ide.JetBrainsIDEConfig { +// ProvideIDEJetBrainsConfig loads the IdeType IDE config from the main config. +func ProvideIDEJetBrainsConfig(config *types.Config) *ide.JetBrainsIDEConfig { return &ide.JetBrainsIDEConfig{ - Port: config.IDE.Intellij.Port, + IntelliJPort: config.IDE.Intellij.Port, + GolandPort: config.IDE.Goland.Port, + PyCharmPort: config.IDE.PyCharm.Port, + WebStormPort: config.IDE.WebStorm.Port, + PHPStormPort: config.IDE.PHPStorm.Port, + CLionPort: config.IDE.CLion.Port, + RubyMinePort: config.IDE.RubyMine.Port, } } diff --git a/cmd/gitness/wire.go b/cmd/gitness/wire.go index aa8efe1c3..76155d888 100644 --- a/cmd/gitness/wire.go +++ b/cmd/gitness/wire.go @@ -273,7 +273,7 @@ func initSystem(ctx context.Context, config *types.Config) (*cliserver.System, e gitspaceservice.WireSet, cliserver.ProvideGitspaceInfraProvisionerConfig, cliserver.ProvideIDEVSCodeConfig, - cliserver.ProvideIDEIntellijConfig, + cliserver.ProvideIDEJetBrainsConfig, instrument.WireSet, aiagentservice.WireSet, aiagent.WireSet, diff --git a/cmd/gitness/wire_gen.go b/cmd/gitness/wire_gen.go index 6b30082ba..4d597db31 100644 --- a/cmd/gitness/wire_gen.go +++ b/cmd/gitness/wire_gen.go @@ -333,7 +333,7 @@ func initSystem(ctx context.Context, config *types.Config) (*server.System, erro vsCode := ide.ProvideVSCodeService(vsCodeConfig) vsCodeWebConfig := server.ProvideIDEVSCodeWebConfig(config) vsCodeWeb := ide.ProvideVSCodeWebService(vsCodeWebConfig) - jetBrainsIDEConfig := server.ProvideIDEIntellijConfig(config) + jetBrainsIDEConfig := server.ProvideIDEJetBrainsConfig(config) v := ide.ProvideJetBrainsIDEsService(jetBrainsIDEConfig) ideFactory := ide.ProvideIDEFactory(vsCode, vsCodeWeb, v) passwordResolver := secret.ProvidePasswordResolver() diff --git a/types/config.go b/types/config.go index 637b5c333..779e3088a 100644 --- a/types/config.go +++ b/types/config.go @@ -413,8 +413,43 @@ type Config struct { } Intellij struct { - // Port is the port on which the SSH server for Intellij will be accessible. - Port int `envconfig:"GITNESS_IDE_INTELLIJ_PORT" default:"8090"` + // Port is the port on which the SSH server for IntelliJ will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_INTELLIJ_PORT" default:"8090"` + } + + Goland struct { + // Port is the port on which the SSH server for Goland will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_GOLAND_PORT" default:"8091"` + } + + PyCharm struct { + // Port is the port on which the SSH server for PyCharm will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_PYCHARM_PORT" default:"8092"` + } + + WebStorm struct { + // Port is the port on which the SSH server for WebStorm will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_WEBSTORM_PORT" default:"8093"` + } + + CLion struct { + // Port is the port on which the SSH server for CLion will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_CLION_PORT" default:"8094"` + } + + PHPStorm struct { + // Port is the port on which the SSH server for PHPStorm will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_PHPSTORM_PORT" default:"8095"` + } + + RubyMine struct { + // Port is the port on which the SSH server for RubyMine will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_RUBYMINE_PORT" default:"8096"` + } + + Rider struct { + // Port is the port on which the SSH server for Rider will be accessible + Port int `envconfig:"CDE_MANAGER_GITSPACE_IDE_RIDER_PORT" default:"8097"` } }