Skip to content

Commit

Permalink
Create settings as a single data type so we can work with it much mor…
Browse files Browse the repository at this point in the history
…e easily
  • Loading branch information
ChrisWiegman committed Jun 21, 2024
1 parent 7475758 commit 81e8ded
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
108 changes: 108 additions & 0 deletions internal/settings/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,114 @@ package settings

// The following are the default settings for Kana.

var defaults = []Option{
{
Name: "activate",
Type: "bool",
Default: "true",
},
{
Name: "admin.email",
Type: "string",
Default: "admin@sites.kana.sh",
},
{
Name: "admin.password",
Type: "string",
Default: "password",
},
{
Name: "admin.username",
Type: "string",
Default: "admin",
},
{
Name: "automaticlogin",
Type: "bool",
Default: "true",
},
{
Name: "database",
Type: "string",
Default: "mariadb",
},
{
Name: "databaseclient",
Type: "string",
Default: "phpmyadmin",
},
{
Name: "databaseversion",
Type: "string",
Default: mariadbVersion,
},
{
Name: "environment",
Type: "string",
Default: "local",
},
{
Name: "updateinterval",
Type: "int",
Default: "7",
},
{
Name: "mailpit",
Type: "bool",
Default: "false",
},
{
Name: "multisite",
Type: "string",
Default: "none",
},
{
Name: "php",
Type: "string",
Default: "8.2",
},
{
Name: "plugins",
Type: "array",
Default: "",
},
{
Name: "removedefaultplugins",
Type: "bool",
Default: "false",
},
{
Name: "scriptdebug",
Type: "bool",
Default: "false",
},
{
Name: "ssl",
Type: "bool",
Default: "false",
},
{
Name: "theme",
Type: "string",
Default: "",
},
{
Name: "type",
Type: "string",
Default: "site",
},
{
Name: "wpdebug",
Type: "bool",
Default: "false",
},
{
Name: "xdebug",
Type: "bool",
Default: "false",
},
}

var defaultOptions = Options{
Activate: true,
AdminEmail: "admin@sites.kana.sh",
Expand Down
7 changes: 7 additions & 0 deletions internal/settings/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ type File struct {
Template string
}

type Option struct {
Name string
Value string
Type string
Default string
}

// Options represents the options that can be configured by a user either globally or through a site's .kana.json.
type Options struct {
Activate bool // Activate the plugin or theme for the appropriate site type.
Expand Down

0 comments on commit 81e8ded

Please sign in to comment.