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

refactor to split go-devops-platform #23

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Go generate
run: |
go generate ./...
touch pkg/rest/static/placeholder # we're not building frontend, so we put a placeholder
touch cmd/rest-server/static/placeholder # we're not building frontend, so we put a placeholder
- name: Test
run: make test
142 changes: 0 additions & 142 deletions cmd/cloudwatch-ingestion/main.go

This file was deleted.

18 changes: 0 additions & 18 deletions cmd/observability-rest-server/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/reset-admin-password/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strings"
"syscall"

localstorage "github.com/in4it/go-devops-platform/storage/local"
"github.com/in4it/wireguard-server/pkg/commands"
localstorage "github.com/in4it/wireguard-server/pkg/storage/local"

"golang.org/x/term"
)
Expand Down
44 changes: 42 additions & 2 deletions cmd/rest-server/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
package main

import (
"embed"
"flag"
"log"

"github.com/in4it/wireguard-server/pkg/rest"
"github.com/in4it/go-devops-platform/auth/provisioning/scim"
"github.com/in4it/go-devops-platform/licensing"
"github.com/in4it/go-devops-platform/rest"
localstorage "github.com/in4it/go-devops-platform/storage/local"
"github.com/in4it/go-devops-platform/users"
"github.com/in4it/wireguard-server/pkg/vpn"
"github.com/in4it/wireguard-server/pkg/wireguard"
)

var (
//go:embed static
assets embed.FS
)

func main() {
Expand All @@ -14,5 +27,32 @@ func main() {
flag.IntVar(&httpPort, "http-port", 80, "http port to run server on")
flag.IntVar(&httpsPort, "https-port", 443, "https port to run server on")
flag.Parse()
rest.StartServer(httpPort, httpsPort, rest.SERVER_TYPE_VPN)

localStorage, err := localstorage.New()
if err != nil {
log.Fatalf("couldn't initialize storage: %s", err)
}
licenseUserCount, cloudType := licensing.GetMaxUsers(localStorage)

userStore, err := users.NewUserStoreWithHooks(localStorage, licenseUserCount, users.UserHooks{
DisableFunc: wireguard.DisableAllClientConfigs,
DeleteFunc: wireguard.DeleteAllClientConfigs,
ReactivateFunc: wireguard.ReactivateAllClientConfigs,
})
if err != nil {
log.Fatalf("startup failed: userstore initialization error: %s", err)
}

scimInstance := scim.New(localStorage, userStore, "")

apps := map[string]rest.AppClient{
"vpn": vpn.New(localStorage, userStore),
}

c, err := rest.NewContext(localStorage, rest.SERVER_TYPE_VPN, userStore, scimInstance, licenseUserCount, cloudType, apps)
if err != nil {
log.Fatalf("startup failed: %s", err)
}

rest.StartServer(httpPort, httpsPort, rest.SERVER_TYPE_VPN, localStorage, c, assets)
}
File renamed without changes.
46 changes: 24 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,33 @@ require (
github.com/packetcap/go-pcap v0.0.0-20240528124601-8c87ecf5dbc5
github.com/russellhaering/gosaml2 v0.9.1
github.com/russellhaering/goxmldsig v1.4.0
golang.org/x/crypto v0.27.0
golang.org/x/sys v0.25.0
golang.org/x/term v0.24.0
golang.org/x/crypto v0.28.0
golang.org/x/sys v0.26.0
golang.org/x/term v0.25.0
)

require github.com/in4it/go-devops-platform v0.0.0-20241015191315-e2f711a32e69 // indirect

require (
github.com/aws/aws-sdk-go-v2 v1.31.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.33 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.32 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.18 // indirect
github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.43 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.40.2
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.19 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.17 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.61.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.7 // indirect
github.com/aws/smithy-go v1.21.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.65.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect
github.com/aws/smithy-go v1.22.0 // indirect
github.com/beevik/etree v1.4.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -45,7 +47,7 @@ require (
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/text v0.19.0 // indirect
)
Loading
Loading