feat: allow homepage customization
Some checks reported warnings
arcad/arcast/pipeline/head This commit is unstable
Some checks reported warnings
arcad/arcast/pipeline/head This commit is unstable
This commit is contained in:
@ -68,6 +68,11 @@ func Run() *cli.Command {
|
||||
EnvVars: []string{"ARCAST_DESKTOP_ALLOWED_ORIGINS"},
|
||||
Value: cli.NewStringSlice(),
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "custom-files-dir",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_CUSTOM_FILES_DIR"},
|
||||
Value: "",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "dummy-browser",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_DUMMY_BROWSER"},
|
||||
@ -114,21 +119,11 @@ func Run() *cli.Command {
|
||||
|
||||
conf := config.DefaultConfig()
|
||||
|
||||
logger.Info(ctx.Context, "loading or creating configuration file", logger.F("filename", configFile))
|
||||
if err := config.LoadOrCreate(ctx.Context, configFile, conf, config.DefaultTransforms...); err != nil {
|
||||
logger.Error(ctx.Context, "could not load configuration file", logger.CapturedE(errors.WithStack(err)))
|
||||
}
|
||||
|
||||
instanceID := ctx.String("instance-id")
|
||||
if instanceID != "" {
|
||||
conf.InstanceID = instanceID
|
||||
}
|
||||
|
||||
cert, err := tls.X509KeyPair(conf.HTTPS.Cert, conf.HTTPS.Key)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not parse tls cert/key pair")
|
||||
}
|
||||
|
||||
if ctx.IsSet("apps") {
|
||||
conf.Apps.Enabled = ctx.Bool("apps")
|
||||
}
|
||||
@ -145,6 +140,20 @@ func Run() *cli.Command {
|
||||
conf.AllowedOrigins = ctx.StringSlice("allowed-origins")
|
||||
}
|
||||
|
||||
if ctx.IsSet("custom-dir") {
|
||||
conf.HTTP.CustomDir = ctx.String("custom-dir")
|
||||
}
|
||||
|
||||
logger.Info(ctx.Context, "loading or creating configuration file", logger.F("filename", configFile))
|
||||
if err := config.LoadOrCreate(ctx.Context, configFile, conf, config.DefaultTransforms...); err != nil {
|
||||
logger.Error(ctx.Context, "could not load configuration file", logger.CapturedE(errors.WithStack(err)))
|
||||
}
|
||||
|
||||
cert, err := tls.X509KeyPair(conf.HTTPS.Cert, conf.HTTPS.Key)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not parse tls cert/key pair")
|
||||
}
|
||||
|
||||
server := server.New(browser,
|
||||
server.WithInstanceID(conf.InstanceID),
|
||||
server.WithAppsEnabled(conf.Apps.Enabled),
|
||||
@ -154,6 +163,7 @@ func Run() *cli.Command {
|
||||
server.WithTLSAddress(conf.HTTPS.Address),
|
||||
server.WithTLSCertificate(&cert),
|
||||
server.WithAllowedOrigins(conf.AllowedOrigins...),
|
||||
server.WithUpperLayerDir(conf.HTTP.CustomDir),
|
||||
)
|
||||
|
||||
if err := server.Start(); err != nil {
|
||||
|
Reference in New Issue
Block a user