Documentation
¶
Overview ¶
Package setup serves the first-installation wizard. While the server has no usable configuration, the command line serves this page on the loopback interface, on the configured port, instead of the API. The page tests the database and Redis the installer enters; on submit the wizard checks the input and that the database is empty, writes the configuration file, migrates the database and creates the first administrator, then signals the caller to start the real server. The file is written before the migration, so a migration that fails leaves an installation the next start resumes (the bootstrap migrates and seeds the administrator named in the file) instead of a database the wizard refuses as already used.
Index ¶
- Constants
- func Address(port int) string
- func HandleDatabaseTest(_ context.Context, ctx *app.RequestContext)
- func HandleMySQLTest(ctx context.Context, requestCtx *app.RequestContext)
- func HandleRedisTest(ctx context.Context, requestCtx *app.RequestContext)
- func Start(path string, port int) (<-chan error, *server.Hertz)
Constants ¶
const DefaultPort = 8080
DefaultPort is the port the wizard listens on when the configuration names none.
const MinAdminPasswordLength = 8
MinAdminPasswordLength is the shortest administrator password the wizard accepts; the page enforces the same, the handler does not trust it.
Variables ¶
This section is empty.
Functions ¶
func Address ¶ added in v1.21.0
Address is the wizard's listen address for port: the loopback interface, so the unauthenticated installer is reachable from the host only.
func HandleDatabaseTest ¶
func HandleDatabaseTest(_ context.Context, ctx *app.RequestContext)
func HandleMySQLTest ¶
func HandleMySQLTest(ctx context.Context, requestCtx *app.RequestContext)
func HandleRedisTest ¶
func HandleRedisTest(ctx context.Context, requestCtx *app.RequestContext)
HandleRedisTest reports whether the Redis server the installer entered answers, before the configuration is written.
func Start ¶
Start serves the first-installation UI on 127.0.0.1 and port (DefaultPort when zero). The channel receives nil once the installation is complete and the caller can start the real server, or the error that stopped the listener; the caller decides what to do about that, so no goroutine here ends the process.
Types ¶
This section is empty.