Documentation
¶
Overview ¶
Package setup implements the nself init wizard: project scaffolding, secret generation, .env file creation, and .nself/ directory setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureEnvFilePermissions ¶
EnsureEnvFilePermissions fixes the permissions of an existing env file to 0600 if they are more permissive. It is a no-op if the file does not exist.
func GenerateSecret ¶
GenerateSecret returns a crypto/rand base64url string of the given length, with URL-unsafe characters stripped. Suitable for passwords and API keys.
func WriteEnvFile ¶
WriteEnvFile writes env file content to path with restrictive 0600 permissions (owner read/write only). Parent directories are created as needed.
Types ¶
type Options ¶
type Options struct {
Fast bool
Interactive bool
NonInteractive bool
Template string
SkipValidation bool
Wizard bool
Demo bool
Full bool
Force bool
Quiet bool
WorkDir string
Name string
// Domain is the BASE_DOMAIN value. When set (e.g. via --domain flag or
// interactive wizard), it takes precedence over env vars and defaults.
Domain string
// DomainComment is written as a comment above BASE_DOMAIN in the generated
// .env. It describes the chosen domain pattern for operator clarity.
DomainComment string
}
Options holds all flags and settings for the init command.
type Result ¶
type Result struct {
ProjectName string
BaseDomain string
Env string
FilesCreated []string
Demo bool
}
Result holds the outcome of a successful init run.
func Initialize ¶
Initialize runs the full init flow: validate inputs, generate secrets, write .env files, create .nself/ directory, and return a Result.