Go Configuration
To effectively work with the Helix project in Go, ensure to utilize the module name defined for building the Go application. Here’s a specific setup for your Go files:
- Update your Go module by setting the module name in the
go.mod
file.
module github.com/helixml/helix
After setting your module name, you will build your application using the command:
go build
Make sure that you never use -mod=vendor
, as it is not supported per the guidelines.
TypeScript Configuration
Configuring TypeScript in helixml/helix requires setting up your tsconfig.json
file. Below is an example configuration that specifies compiler options:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
After creating or updating the tsconfig.json
, compile the TypeScript files with:
tsc
Python Configuration
For Python, create a requirements.txt
file to manage the required packages for the helix project environment. Use the following structure to define the dependencies:
flask==2.0.1
requests==2.25.1
To install these dependencies, execute:
pip install -r requirements.txt
Shell Configuration
In your shell script files, you might want to define environment variables to control configurations. For instance, set up a file named env.sh
as follows:
#!/bin/bash
export DATABASE_URL="your_database_url"
export PORT=8080
Then, source this file at the start of your shell scripts:
source env.sh
Smarty Configuration
For custom templates using Smarty, set the configuration in your PHP files like this:
require_once('../libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->setTemplateDir('/path/to/templates');
$smarty->setCompileDir('/path/to/templates_c');
$smarty->setCacheDir('/path/to/cache');
$smarty->setConfigDir('/path/to/configs');
$smarty->assign('name', 'User');
$smarty->display('index.tpl');
Ensure that the template directories exist and have the appropriate permissions to prevent issues during runtime.
Docker Configuration
For containerizing your Helix application, a Dockerfile must be created in your project’s root directory. Below is an example Dockerfile setup:
# Use an official Go runtime as a parent image
FROM golang:1.16
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . .
# Build the Go application
RUN go build -o helix .
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Run the helix binary
CMD ["./helix"]
Build your Docker image using the command:
docker build -t helix .
HTML Configuration
For serving static files or templates, ensure that the HTML files are placed in the appropriate directories and linked correctly. For example:
<!DOCTYPE html>
<html>
<head>
<title>Helix Application</title>
</head>
<body>
<h1>Welcome to Helix</h1>
<script src="app.js"></script>
</body>
</html>
Properly reference your JavaScript and CSS files to maintain an organized structure throughout your project.
Mako Configuration
When using Mako for templating in Python, ensure to create Mako templates following this structure:
<%!
def render_title(title):
return f"<title>{title}</title>"
%>
<html>
<head>
${render_title('Helix Application')}
</head>
<body>
<h1>Welcome to Helix</h1>
</body>
</html>
Properly configure your Mako template directory to streamline template rendering from your Python application.
Sources: helixml/helix documentation as specified above.