title: Goweb Configuration Reference version: 1.0.0 author: Pierre Laplante / PLCB

date: 2025-09-17

πŸ“„ Goweb Configuration Reference

This document describes the structure and purpose of the Goweb configuration TOML file.


πŸ“ [description]

Key Type Example Value Description
version String "0.0.0" Application version identifier.
plugin Array [ "example", "csv", "geoip" ] List of plugin names to load at startup.
timeout Duration "10s" Default timeout for operations.
load Path "/Users/laplante/go/src/goweb/tests/load.gw" Path to the main Goweb script to load at startup.
error Path "/Users/laplante/go/src/goweb/tests/error.gw" Path to the error-handling Goweb script.
preload String "preload" Identifier or directory for preloading resources before execution.
redirect String "redirect" Identifier or directory for handling redirects.
debug Integer 1 Debug mode flag (0 = off, 1 = enabled).

🌐 [http_server]

Key Type Example Value Description
port String ":8081" Listening port for the HTTP server.
docroot Path "/Users/laplante/go/src/goweb/tests" Document root for serving files.
htmldir Path "/html" Directory containing HTML templates.
logdir Path "/log" Directory for storing HTTP server logs.
readtimeout Duration "10s" Maximum time to read a request.
writetimeout Duration "10s" Maximum time to write a response.
url URL "http://localhost:8081" Base URL for the server.
max_upload_size Integer 1048576 Maximum upload size in bytes (here: 1 MB).
exec_dir Array [ "/" ] Directories allowed for executing Goweb scripts.
csrf Boolean true Enables CSRF protection.
csrfList Array [ "https://tracking.plcb.ca", "https://myip.plcb.ca" ] List of trusted origins for cross-site requests.

πŸ—„ [default_db]

Key Type Example Value Description
source_name String "goweb:goweb@tcp(127.0.0.1:3306)/goweb" Data source name (DSN) for database access.
driver_name String "mysql" Database driver to use (mysql, postgres).

🌍 [lg] (Locales)

Key Type Example Value Description
fr String "fr_CA.UTF-8" Locale for French (Linux: fr_CA.utf8).
en String "en_CA.UTF-8" Locale for English.

πŸ”Œ Plugin Sections

Each plugin section specifies how to load a dynamic library (.so file) and its initialization function.

[example]

Key Example Value Description
file "/usr/local/lib/example.so" Path to the plugin’s shared object file.
init "Register_function" Initialization function to call.

[csv]

Key Example Value Description
file "/usr/local/lib/csv.so" Path to the CSV plugin file.
init "Register_function" Initialization function.

[geoip]

Key Example Value Description
file "/usr/local/lib/geoip.so" Path to the GeoIP plugin file.
init "Register_function" Initialization function.

βœ… Usage Notes