initcreds

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package initcreds writes / clears the initial-admin credentials file.

On first boot wick may auto-generate the admin password (when env APP_ADMIN_PASSWORD is empty). The plaintext is dropped into a single file under the per-app data dir so the operator can recover it after installing — the dialog is then "log in, change the password, this file deletes itself". After admin_password_changed is set, callers invoke Clear to remove the file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(appName string) error

Clear removes the credentials file. Missing file is not an error.

func Path

func Path(appName string) (string, error)

Path returns the absolute file path under ~/.<appName>/. appName empty → falls back to the binary basename via userconfig.Dir.

func Write

func Write(appName, email, password, appURL string) (string, error)

Write creates the credentials file with mode 0600 (owner read/write). Overwrites any existing file. Caller passes appName so the file lands in the same per-app dir as logs / config.

Types

type Info

type Info struct {
	URL      string
	Email    string
	Password string
}

Info is the parsed contents of INITIAL_CREDENTIALS.txt. Empty fields when parsing failed or the file is missing.

func Read

func Read(appName string) (Info, bool)

Read parses the credentials file. Returns ok=false (and a zero Info) when the file is missing — callers treat that as "already changed". Surface-level parser only: looks for the "URL:", "Email:", "Default password:" prefixes Write emits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL