Skip to content

Commit

Permalink
Make sure and import modules in the main.go (#78)
Browse files Browse the repository at this point in the history
Srop doing this in the common module.

Which modules a server/cli use should be decided by the end builder, not common code.
  • Loading branch information
sfc-gh-jchacon authored Feb 28, 2022
1 parent 52f81ad commit 99c18f5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 deletions.
10 changes: 10 additions & 0 deletions cmd/proxy-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ import (
"github.com/Snowflake-Labs/sansshell/cmd/proxy-server/server"
"github.com/Snowflake-Labs/sansshell/cmd/util"
"github.com/go-logr/stdr"

// Import services here to make them proxy-able
_ "github.com/Snowflake-Labs/sansshell/services/ansible"
_ "github.com/Snowflake-Labs/sansshell/services/exec"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck"
_ "github.com/Snowflake-Labs/sansshell/services/localfile"
_ "github.com/Snowflake-Labs/sansshell/services/packages"
_ "github.com/Snowflake-Labs/sansshell/services/process"
_ "github.com/Snowflake-Labs/sansshell/services/sansshell/server"
_ "github.com/Snowflake-Labs/sansshell/services/service"
)

var (
Expand Down
11 changes: 1 addition & 10 deletions cmd/proxy-server/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,11 @@ import (
"github.com/Snowflake-Labs/sansshell/auth/mtls"
"github.com/Snowflake-Labs/sansshell/auth/opa/rpcauth"
"github.com/Snowflake-Labs/sansshell/proxy/server"
ss "github.com/Snowflake-Labs/sansshell/services/sansshell/server"
"github.com/Snowflake-Labs/sansshell/telemetry"
"github.com/go-logr/logr"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"

// Import services here to make them proxy-able
_ "github.com/Snowflake-Labs/sansshell/services/ansible"
_ "github.com/Snowflake-Labs/sansshell/services/exec"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck"
_ "github.com/Snowflake-Labs/sansshell/services/localfile"
_ "github.com/Snowflake-Labs/sansshell/services/packages"
_ "github.com/Snowflake-Labs/sansshell/services/process"
ss "github.com/Snowflake-Labs/sansshell/services/sansshell/server"
_ "github.com/Snowflake-Labs/sansshell/services/service"
)

// RunState encapsulates all of the variable state needed
Expand Down
9 changes: 0 additions & 9 deletions cmd/sanssh/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ import (
"github.com/google/subcommands"
"google.golang.org/grpc"

// Import services here to make them proxy-able
_ "github.com/Snowflake-Labs/sansshell/services/ansible/client"
_ "github.com/Snowflake-Labs/sansshell/services/exec/client"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck/client"
_ "github.com/Snowflake-Labs/sansshell/services/localfile/client"
_ "github.com/Snowflake-Labs/sansshell/services/packages/client"
_ "github.com/Snowflake-Labs/sansshell/services/process/client"
_ "github.com/Snowflake-Labs/sansshell/services/sansshell/client"
_ "github.com/Snowflake-Labs/sansshell/services/service/client"
"github.com/Snowflake-Labs/sansshell/services/util"
)

Expand Down
10 changes: 10 additions & 0 deletions cmd/sanssh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ import (
"github.com/Snowflake-Labs/sansshell/services/util"
"github.com/google/subcommands"
"google.golang.org/grpc/metadata"

// Import services here to make them accessible for CLI
_ "github.com/Snowflake-Labs/sansshell/services/ansible/client"
_ "github.com/Snowflake-Labs/sansshell/services/exec/client"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck/client"
_ "github.com/Snowflake-Labs/sansshell/services/localfile/client"
_ "github.com/Snowflake-Labs/sansshell/services/packages/client"
_ "github.com/Snowflake-Labs/sansshell/services/process/client"
_ "github.com/Snowflake-Labs/sansshell/services/sansshell/client"
_ "github.com/Snowflake-Labs/sansshell/services/service/client"
)

var (
Expand Down
10 changes: 10 additions & 0 deletions cmd/sansshell-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ import (
"github.com/Snowflake-Labs/sansshell/auth/opa/rpcauth"
"github.com/Snowflake-Labs/sansshell/cmd/sansshell-server/server"
"github.com/Snowflake-Labs/sansshell/cmd/util"

// Import the server modules you want to expose, they automatically register
_ "github.com/Snowflake-Labs/sansshell/services/ansible/server"
_ "github.com/Snowflake-Labs/sansshell/services/exec/server"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck/server"
_ "github.com/Snowflake-Labs/sansshell/services/localfile/server"
_ "github.com/Snowflake-Labs/sansshell/services/packages/server"
_ "github.com/Snowflake-Labs/sansshell/services/process/server"
_ "github.com/Snowflake-Labs/sansshell/services/sansshell/server"
_ "github.com/Snowflake-Labs/sansshell/services/service/server"
)

var (
Expand Down
10 changes: 0 additions & 10 deletions cmd/sansshell-server/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ import (
"github.com/Snowflake-Labs/sansshell/auth/opa/rpcauth"
"github.com/Snowflake-Labs/sansshell/server"
"github.com/go-logr/logr"

// Import the server modules you want to expose, they automatically register
_ "github.com/Snowflake-Labs/sansshell/services/ansible/server"
_ "github.com/Snowflake-Labs/sansshell/services/exec/server"
_ "github.com/Snowflake-Labs/sansshell/services/healthcheck/server"
_ "github.com/Snowflake-Labs/sansshell/services/localfile/server"
_ "github.com/Snowflake-Labs/sansshell/services/packages/server"
_ "github.com/Snowflake-Labs/sansshell/services/process/server"
_ "github.com/Snowflake-Labs/sansshell/services/sansshell/server"
_ "github.com/Snowflake-Labs/sansshell/services/service/server"
)

type RunState struct {
Expand Down

0 comments on commit 99c18f5

Please sign in to comment.