Documentation
¶
Index ¶
- Constants
- Variables
- func Contains(s []string, e string) bool
- func DeleteAllPaths(path string) error
- func DeletePath(path string) error
- func GetIcon(unicode, colour string) string
- func GetLocalhost() string
- func GetPort(low, hi int) int
- func Init(config Config)
- func MapToStringArray(payload map[string]interface{}) []string
- func PathExists(filePath string) bool
- func PortAvaiable(port string) bool
- func Rel(path string) string
- func RuntimeVars(port string, networkBased bool) map[string]interface{}
- type Config
- type Status
- func (s *Status) Clean()
- func (s *Status) Error(text string)
- func (s *Status) Errorln(text string)
- func (s *Status) Executing(text string)
- func (s *Status) Executingln(text string)
- func (s *Status) Fatal(text string)
- func (s *Status) Increment(value int)
- func (s *Status) Info(text string)
- func (s *Status) Infoln(text string)
- func (s *Status) Print()
- func (s *Status) Reset()
- func (s *Status) Set(text string)
- func (s *Status) Success(text string)
- func (s *Status) Successln(text string)
- func (s *Status) Suppressed(text string)
- func (s *Status) Suppressedln(text string)
- func (s *Status) Update(value int)
- func (s *Status) Warn(text string)
- func (s *Status) Warnln(text string)
Constants ¶
const ( GEAR = "⚙" CHECK = "✔" CANCEL = "✘" INFO = "ℹ" WARN = "⚠" ERROR = "✖" HOURGLASS = "⌛" )
const ( Bold = "\033[1m" Reset = "\033[0m" Green = "\033[32m" Blue = "\033[34m" Yellow = "\033[33m" Cyan = "\033[36m" Red = "\033[31m" Gray = "\033[37;2m" )
Initialize console colours
const ( // Common Error Codes WarnDockerNotFound = "Make sure Docker is running and restart `nhost dev`" ErrDockerNotFound = "Docker not running" ErrServicesNotFound = "No services found currently running for this app" // Common Information Codes InfoDockerDownload = "Download docker from: https://www.docker.com/products/docker-desktop" InfoServicesRunning = "Start your app with `nhost dev`" )
const ( API_VERSION = "v1" // initiaze webhook-secret for Hasura Authentication WEBHOOK_SECRET = "nhost-webhook-secret" // initiaze admin-secret for Hasura Authentication ADMIN_SECRET = "nhost-admin-secret" )
Variables ¶
var ( // Initiaze JWT key for Hasura Authentication JWT_KEY = generateRandomKey(32) // Map of environment specific variables generated dynamically on runtime. RUNTIME_VARS = map[string]interface{}{ "HASURA_GRAPHQL_JWT_SECRET": fmt.Sprintf(`{"type":"HS256", "key": "%v"}`, JWT_KEY), "NHOST_JWT_SECRET": fmt.Sprintf(`{"type":"HS256", "key": "%v"}`, JWT_KEY), "HASURA_GRAPHQL_ADMIN_SECRET": ADMIN_SECRET, "NHOST_ADMIN_SECRET": ADMIN_SECRET, "NHOST_WEBHOOK_SECRET": WEBHOOK_SECRET, } )
var (
WORKING_DIR string
)
Functions ¶
func DeleteAllPaths ¶
deletes all the paths leading to the given file/folder and unlink from filesystem
func DeletePath ¶
deletes the given file/folder path and unlink from filesystem
func GetLocalhost ¶ added in v0.5.5
func GetLocalhost() string
Returns preferred local address value for accessing resources throughout docker containers, depending on the Operating System.
For Mac and Windows, the address value is "host.docker.internal". And for Linux, we are using the Outbound IP of host machine.
func MapToStringArray ¶ added in v0.5.5
Wraps given map into string array
func PathExists ¶
validates whether a given folder/file path exists or not
func PortAvaiable ¶ added in v0.5.9
func RuntimeVars ¶ added in v0.5.5
Augments default runtime variables, with dynamically generated ones, specific to the environment. For example: Backend URL with environment port.
If the additional `networkBased` flag is true, it makes sure to use that localhost address value, which can be accessed by docker across host network.
This is because docker requires different local addresses, depending on the host operating system.
Types ¶
type Status ¶ added in v0.5.9
type Status struct {
Value int
Total int
Text string
Icon string
// contains filtered or unexported fields
}
Status is an in-line output structure that holds the status text and icon
var ( // New base writer for all tasks Writer Status )
func (*Status) Clean ¶ added in v0.5.9
func (s *Status) Clean()
Delete all text from line, and shift cursor back to beginning of line
func (*Status) Executing ¶ added in v0.5.9
Change the status icon to yellow coloured gear, and set the text
func (*Status) Executingln ¶ added in v0.5.9
Print the execution status in a new line
func (*Status) Suppressed ¶ added in v0.5.9
Change the status icon to gray coloured gear, and set the text
func (*Status) Suppressedln ¶ added in v0.5.9
Print the supressed status in a new line