mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-19 02:40:33 +00:00
✨ Ask for license key input
This commit is contained in:
parent
b11619fbfa
commit
db8c9ec163
45
cmd/pro.go
45
cmd/pro.go
@ -27,7 +27,7 @@ var proCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PRO_URL = "https://master.d2hqi2yb1n0lz7.amplifyapp.com/"
|
PRO_URL = "https://console.kubeshark.co"
|
||||||
PRO_PORT = 5252
|
PRO_PORT = 5252
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,6 +64,20 @@ func acquireLicense() {
|
|||||||
runLicenseRecieverServer()
|
runLicenseRecieverServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateLicense(licenseKey string) {
|
||||||
|
config.Config.License = licenseKey
|
||||||
|
err := config.WriteConfig(&config.Config)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
connector.PostLicense(config.Config.License)
|
||||||
|
|
||||||
|
log.Info().Msg("Updated the license. Exiting.")
|
||||||
|
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
func runLicenseRecieverServer() {
|
func runLicenseRecieverServer() {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
ginApp := gin.New()
|
ginApp := gin.New()
|
||||||
@ -92,20 +106,21 @@ func runLicenseRecieverServer() {
|
|||||||
|
|
||||||
log.Info().Str("key", licenseKey).Msg("Received license:")
|
log.Info().Str("key", licenseKey).Msg("Received license:")
|
||||||
|
|
||||||
config.Config.License = licenseKey
|
updateLicense(licenseKey)
|
||||||
err = config.WriteConfig(&config.Config)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
connector.PostLicense(config.Config.License)
|
|
||||||
|
|
||||||
log.Info().Msg("Updated the license.")
|
|
||||||
|
|
||||||
os.Exit(0)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := ginApp.Run(fmt.Sprintf(":%d", PRO_PORT)); err != nil {
|
go func() {
|
||||||
panic(err)
|
if err := ginApp.Run(fmt.Sprintf(":%d", PRO_PORT)); err != nil {
|
||||||
}
|
panic(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
log.Info().Str("url", PRO_URL).Msg("Opened the login page in your browser:")
|
||||||
|
|
||||||
|
log.Info().Msg("Alternatively enter your license key:")
|
||||||
|
|
||||||
|
var licenseKey string
|
||||||
|
fmt.Scanf("%s", &licenseKey)
|
||||||
|
|
||||||
|
updateLicense(licenseKey)
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func InitConfig(cmd *cobra.Command) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmd.Use != "console" {
|
if cmd.Use != "console" && cmd.Use != "pro" {
|
||||||
go version.CheckNewerVersion()
|
go version.CheckNewerVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user