Skip to main content

Configuring FaaS

Creating a functions file also creates a settings file called photoniq.toml. This file allows you to configure fields like cors and log settings for your functions, thus allowing function-specific customizations.

Here is an example of this photonIQ.toml file:

name = "testFunction"
version = "0.0.1"
description = "Description for function testFunction"
lang = "rust"
#execute_url_suffix = "optional_url_suffix_to_execute_function"

[cors_settings]
allowed_methods = ["GET","POST"]
allowed_hosts = ["macrometa.com"]
allow_http = true

[log_settings]
enabled = true
level = "INFO"

[env_vars]
MESSAGE = "Hello 👋! This message comes from an environment variable"

Here is a table explaining all the fields:

FieldDescription
nameThe name of the function.
versionThe version of the function.
descriptionA brief description of the function.
langThe programming language used to write the function.
execute_url_suffixAn optional URL suffix used to execute the function.
cors_settingsConfiguration settings for Cross-Origin Resource Sharing (CORS).
cors_settings.allowed_methodsHTTP methods allowed for CORS.
cors_settings.allowed_hostsHosts allowed to access the function.
cors_settings.allow_httpBoolean indicating if HTTP is allowed.
log_settingsConfiguration settings for logging.
log_settings.enabledBoolean indicating if logging is enabled.
log_settings.levelThe log level (e.g., INFO, DEBUG).
env_varsEnvironment variables used by the function.
env_vars.MESSAGEAn environment variable containing a message.