launcher: application launcher
Change-Id: I81d49a0651702dc821d683d6a4b3bbff6af3c753
diff --git a/core/installer/cmd/launcher.go b/core/installer/cmd/launcher.go
new file mode 100644
index 0000000..d86196b
--- /dev/null
+++ b/core/installer/cmd/launcher.go
@@ -0,0 +1,46 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/giolekva/pcloud/core/installer/welcome"
+ "github.com/spf13/cobra"
+)
+
+var launcherFlags struct {
+ logoutUrl string
+ port int
+}
+
+func launcherCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "launcher",
+ RunE: launcherCmdRun,
+ }
+ cmd.Flags().IntVar(
+ &launcherFlags.port,
+ "port",
+ 8080,
+ "",
+ )
+ cmd.Flags().StringVar(
+ &launcherFlags.logoutUrl,
+ "logout-url",
+ "",
+ "",
+ )
+ return cmd
+}
+
+func launcherCmdRun(cmd *cobra.Command, args []string) error {
+ s, err := welcome.NewLauncherServer(
+ launcherFlags.port,
+ launcherFlags.logoutUrl,
+ &welcome.FakeAppDirectory{},
+ )
+ if err != nil {
+ return fmt.Errorf("failed to create LauncherServer: %v", err)
+ }
+ s.Start()
+ return nil
+}