Initializing Lyrid App

Creating new Application#

User will be able to initialize their function using the following command:

lc code init --name "<AppName>" --module "<ModuleName>" --function "<FunctionName>" --language "<language>"

File Structure#

The user will then be presented with a few files that have this structure:

β”‚ .env << Environment Variable
β”‚ .lyrid-definition.yml << Module Definition
β”‚ go.mod
β”‚ main.go << Main
entry.go << Entry Function

Entry Function#

Entry function is the location that will be the wrapped by the platform to create a Lyrid Function.


Main is the way user can test their function locally. The user will be able to test the input/output of their functions and execute them locally by giving the function the appropriate parameter. User will be able to call the following in order to create an executable that can be launched locally:

go build main.go

Environment Variable#

Environment variable is how the user can pass information into the system and retrieve it by using the environment variable calls. You will be able to get these string variables by calling:

Restricted Variable

Some of the variables are reserved by the platform. The Lyrid platform will automatically update these following values at the time of build:

  • CLOUD_ENV ------------- The current execution cloud framework.

    Possible Values : AWS (Amazon), GCP (Google), LYR (Lyrid), Local

  • TEMP_DIR ------------- File system writable temporary directory.

    Possible Values : . (Google/Lyrid/Local), /tmp (Amazon)

Module Definition#

The Module Definition is the definition of the current module in the folder. The user will be able to create more function entry points into the module using this definition. Only function that is listed inside this definition is the one that will be wrapped by the platform into Lyrid Function that can be launched by different serverless cloud platform.

After the user initializes their function, they will be able to update the entry point, and create their source code package within the folder.

External Dependency#

Any external dependency that cannot be pulled by the Internet (by "go get"/"pip"/"npm install"/"dotnet restore") needs to be placed into the same folder.

Start Coding#

After understanding the file structure , you can start your first code !