Documentation
¶
Index ¶
- Constants
- Variables
- func Contains(s []string, e string) bool
- func DeleteAllPaths(path string) error
- func DeletePath(path string) error
- func GetLocalhost() string
- func MapToStringArray(payload map[string]interface{}) []string
- func PathExists(filePath string) bool
- func Rel(path string) string
- func RuntimeVars(port string, networkBased bool) map[string]interface{}
Constants ¶
const ( // Common Error Codes WarnDockerNotFound = "Please start docker and re-run `nhost`" 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, _ = os.Getwd()
)
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 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 ¶
This section is empty.