Documentation
¶
Overview ¶
---------------------------------------------------------------------------- The code here is about the configuration of Aldev ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about cancelable contexts, to help gracefully stop some processes ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about local deployment with Containers / Kubernetes / Tilt ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about local deployment without Containers / Kubernetes / Tilt ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about downloading external resources ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about handling HTTP requests ----------------------------------------------------------------------------
---------------------------------------------------------------------------- Downloading translations from a Google sheet into a local, structured file ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about logging in the shell ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about running stuff in parallel ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about executing shell commands ----------------------------------------------------------------------------
---------------------------------------------------------------------------- Creates the required symlinks, if missing ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about building files from templates, and Aldev config ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is responsible for fetching source code and copy-pasting it into our project, as configured ----------------------------------------------------------------------------
Index ¶
- Constants
- func Debug(str string, params ...any)
- func DeployToLocalCluster(ctx CancelableContext)
- func DeployWithNoContainer(ctx CancelableContext)
- func DownloadExternalResources(ctx CancelableContext, withTranslations bool)
- func EnsureConfigmap()
- func EnsureFileFromTemplate(filepath, tpl string, params ...any)
- func Error(str string, params ...any)
- func GenerateDeployConfigs(ctx CancelableContext, dockerAllowed bool)
- func GetBinDir() string
- func GetCacheDir() string
- func GetConfigPath() string
- func GetGoSrcDir() string
- func Info(str string, params ...any)
- func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
- func InstallGitHooks(ctx CancelableContext)
- func IsDevAPI() bool
- func IsDevLibrary() bool
- func IsDevNative() bool
- func IsDevWebApp() bool
- func NewBaseContext() *baseCancelableContext
- func QuickRun(whyRunThis string, commandAsString string, params ...any)
- func ReadConfig(cfgFileName string)
- func Recover(ctx CancelableContext, msg string, params ...any)
- func Run(whyRunThis string, ctx CancelableContext, logStart bool, ...)
- func RunAndGet(whyRunThis string, execDir string, logStart bool, commandAsString string, ...) []byte
- func RunJobs(aldevCtx CancelableContext, parallel bool)
- func SetCacheDir(cacheDir string)
- func SetVerbose(isVerbose bool)
- func Step(str string, params ...any)
- func StepWithPreamble(preamble, str string, params ...any)
- func UseCodeSwaps()
- func Warn(str string, params ...any)
- func WatcherFor(filepaths ...string) *fsnotify.Watcher
- type AldevConfig
- type AldevContext
- type AldevTask
- type CancelableContext
- type CmdConfig
- type CodeSwapsConfig
- type I18nConfig
- type JobConfig
- type VendorConfig
Constants ¶
const (
TagHOTSWAPPED = "___HOTSWAPPED___"
)
Variables ¶
This section is empty.
Functions ¶
func DeployToLocalCluster ¶
func DeployToLocalCluster(ctx CancelableContext)
func DeployWithNoContainer ¶
func DeployWithNoContainer(ctx CancelableContext)
func DownloadExternalResources ¶
func DownloadExternalResources(ctx CancelableContext, withTranslations bool)
Downloading external resources, like translations, vendors, etc
func EnsureConfigmap ¶
func EnsureConfigmap()
Making sure we have a ConfigMap to pass to K8S before deploying to a local cluster
func EnsureFileFromTemplate ¶
func GenerateDeployConfigs ¶
func GenerateDeployConfigs(ctx CancelableContext, dockerAllowed bool)
func GetCacheDir ¶
func GetCacheDir() string
func GetConfigPath ¶
func GetConfigPath() string
func GetGoSrcDir ¶
func GetGoSrcDir() string
returns the name of the folder where to find the Go source code
func InitAldevContext ¶
func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
func InstallGitHooks ¶
func InstallGitHooks(ctx CancelableContext)
Installing Git hooks to unify our practices
func IsDevLibrary ¶
func IsDevLibrary() bool
func IsDevNative ¶
func IsDevNative() bool
func IsDevWebApp ¶
func IsDevWebApp() bool
func NewBaseContext ¶
func NewBaseContext() *baseCancelableContext
func ReadConfig ¶
func ReadConfig(cfgFileName string)
func Recover ¶
func Recover(ctx CancelableContext, msg string, params ...any)
func Run ¶
func Run(whyRunThis string, ctx CancelableContext, logStart bool, commandAsString string, params ...any)
func RunJobs ¶
func RunJobs(aldevCtx CancelableContext, parallel bool)
func SetCacheDir ¶
func SetCacheDir(cacheDir string)
func SetVerbose ¶
func SetVerbose(isVerbose bool)
func StepWithPreamble ¶
func UseCodeSwaps ¶
func UseCodeSwaps()
func WatcherFor ¶
Types ¶
type AldevConfig ¶
type AldevConfig struct {
AppName string // the name of the app - beware: the key has to be "appname" in the YAML file
Languages string // the languages available for this app, seperated by a comma - for example: en,fr,it,de,zh,es
Lib *struct {
SrcDir string // where the library source code can be found
Config string // the path to the config file for the API, from the API's folder
Install string // command that should be run to install stuff, like needed dependencies, etc.
Develop string // command that should be run to allow for continuously developping & building the library
BinDir string // the directory where to find the library's compiled binary, as seen from the library source folder (srcdir)
// contains filtered or unexported fields
}
API *struct {
SrcDir string // where the API's Goald-based code should be found
Config string // the path to the config file for the API, from the API's folder
Port int // the port used to expose the whole load-balanced API service
I18n *I18nConfig
DataDir string // where to find bootstraping data to run the app
BinDir string // the directory where to find the API's compiled binary, as seen from the API source folder (srcdir)
// contains filtered or unexported fields
}
// APIOnly bool // if true, then no web app is handled
Web *struct {
SrcDir string // where the Web app's GoaldR-based code should be found
Port int // the port used to expose the app's frontend
EnvVars []*struct {
Name string // the variable name; must start with "WEB_"
Desc string // a description for the
Value string // the value we're using for the local dev environment
}
}
Native *struct {
SrcDir string // where the Native app's GoaldN-based code should be found
I18n *I18nConfig //
DataDir string // where to find bootstraping data to run the app
}
Vendors []*VendorConfig // external projects to vendor into our project
Deploying *struct {
Dir string // where all the deploying config should be
}
CodeSwaps []*CodeSwapsConfig // Automatically, temporarily swapping bits of code
Jobs []*JobConfig // Jobs to run
}
func Config ¶
func Config() *AldevConfig
func (*AldevConfig) ResolvedBinDir ¶
func (cfg *AldevConfig) ResolvedBinDir() string
computed property on an Aldev config object
type AldevContext ¶
type AldevContext interface {
CancelableContext
GetLoopCtx() CancelableContext
RestartLoop()
}
an Aldev Context has a loop and allows to restart it
type AldevTask ¶
type AldevTask func(ctx CancelableContext)
characterises the functions run during an aldev command or subcommand
type CancelableContext ¶
type CancelableContext interface {
context.Context
WithExecDir(...string) CancelableContext
WithStdOutWriter(io.Writer) CancelableContext
WithStdErrWriter(io.Writer) CancelableContext
// WithErrLogFn(errLogFn) CancelableContext
// getErrLogFn() errLogFn
WithEnvVars(...string) CancelableContext
WithReRun() CancelableContext
WithAllowFailure(bool) CancelableContext
CancelAll()
NewChildContext() CancelableContext
// contains filtered or unexported methods
}
type CodeSwapsConfig ¶
type CodeSwapsConfig struct {
From string // the path from which to look for swaps; "." for the current project, "../../dependency" to swap in another lib
For []string // the file paths for which to apply the same swaps; can be provided as a glob, e.g. "./src/**/*.ts?",
Do []*struct {
Replace string // the substring to look for and replace
With string // the replacement
EOFCom bool // should the added comment (HOTSWAPPED) be at the end of the line (// ...) rather than inline (/* ... */) ?
}
}
type I18nConfig ¶
type VendorConfig ¶
type VendorConfig struct {
Repo string // the repo of the external project
Branch string // the branch to use; if provided, then the version is ignored
Version string // the maximal version (tag) to fetch; can also be the "latest"
From string // the path inside the repo to copy; if void, then all the repo is copied
To string // the place where to paste the copied cod
}