feat(desktop): pass instance id as flag or environment variable
This commit is contained in:
parent
c53a566fe7
commit
9884855e3c
|
@ -1 +1,2 @@
|
|||
ARCAST_DESKTOP_ADDITIONAL_CHROME_ARGS=
|
||||
ARCAST_DESKTOP_ADDITIONAL_CHROME_ARGS=
|
||||
ARCAST_DESKTOP_INSTANCE_ID=
|
|
@ -9,6 +9,6 @@ func main() {
|
|||
command.Main(
|
||||
"arcast",
|
||||
"Arcast desktop player",
|
||||
player.Root(),
|
||||
player.Root().Subcommands...,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -21,13 +21,20 @@ func Run() *cli.Command {
|
|||
EnvVars: []string{"ARCAST_DESKTOP_ADDITIONAL_CHROME_ARGS"},
|
||||
Value: cli.NewStringSlice("incognito"),
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "window-height",
|
||||
Value: defaults.Height,
|
||||
&cli.StringFlag{
|
||||
Name: "instance-id",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_INSTANCE_ID"},
|
||||
Value: "",
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "window-width",
|
||||
Value: defaults.Width,
|
||||
Name: "window-height",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_HEIGHT"},
|
||||
Value: defaults.Height,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "window-width",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_WIDTH"},
|
||||
Value: defaults.Width,
|
||||
},
|
||||
},
|
||||
Action: func(ctx *cli.Context) error {
|
||||
|
@ -57,7 +64,12 @@ func Run() *cli.Command {
|
|||
}
|
||||
}()
|
||||
|
||||
server := server.New(browser)
|
||||
instanceID := ctx.String("instance-id")
|
||||
if instanceID == "" {
|
||||
instanceID = server.NewRandomInstanceID()
|
||||
}
|
||||
|
||||
server := server.New(browser, server.WithInstanceID(instanceID))
|
||||
|
||||
if err := server.Start(); err != nil {
|
||||
return errors.Wrap(err, "could not start server")
|
||||
|
|
Loading…
Reference in New Issue