Skip to content

Commit

Permalink
fix license checker logic (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes committed Jun 5, 2024
1 parent 5fa2f40 commit 98f2155
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ee/backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"github.com/diggerhq/digger/ee/backend/controllers"
"github.com/diggerhq/digger/libs/license"
"github.com/gin-gonic/gin"
"log"
"net/http"
"os"
)

// based on https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
Expand All @@ -21,7 +23,11 @@ var Version = "dev"
var templates embed.FS

func main() {
license.LicenseKeyChecker{}.Check()
err := license.LicenseKeyChecker{}.Check()
if err != nil {
log.Printf("error checking license %v", err)
os.Exit(1)
}
ghController := ce_controllers.GithubController{
CiBackendProvider: ci_backends2.EEBackendProvider{},
}
Expand Down Expand Up @@ -67,3 +73,8 @@ func main() {
port := config.GetPort()
r.Run(fmt.Sprintf(":%d", port))
}

func init() {
log.SetOutput(os.Stdout)
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
}
6 changes: 6 additions & 0 deletions ee/cli/cmd/digger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
comment_updater_ee "github.com/diggerhq/digger/ee/cli/pkg/comment_updater"
ee_drift "github.com/diggerhq/digger/ee/cli/pkg/drift"
"github.com/diggerhq/digger/libs/comment_utils/summary"
"github.com/diggerhq/digger/libs/license"
core_locking "github.com/diggerhq/digger/libs/locking"
"github.com/diggerhq/digger/libs/locking/gcp"
"log"
Expand Down Expand Up @@ -862,6 +863,11 @@ Exit codes:
*/

func main() {
err := license.LicenseKeyChecker{}.Check()
if err != nil {
log.Printf("error checking license %v", err)
os.Exit(1)
}
if len(os.Args) == 1 {
os.Args = append([]string{os.Args[0]}, "default")
}
Expand Down

0 comments on commit 98f2155

Please sign in to comment.