fn project Function files 说明

主要是文件
  • func.yaml
  • func.json
详细说明如下:

An example of a function file:

name: fnproject/hello
version: 0.0.1
type: sync
memory: 128
config:
  key: value
  key2: value2
  keyN: valueN
headers:
  Content-Type: text/plain
build:
- make
- make test
expects:
  config:
    - name: SECRET_1
      required: true
    - name: SECRET_2
      required: false

name is the name and tag to which this function will be pushed to and the route updated to use it.

path (optional) allows you to overwrite the calculated route from the path position. You may use it to override the calculated route. If you plan to use fn test --remote="", this is mandatory.

version represents current version of the function. When deploying, it is appended to the image as a tag.

runtime represents programming language runtime, for example, 'go', 'python', 'java', etc. The runtime 'docker' will use the existing Dockerfile if one exists.

build (optional) is an array of local shell calls which are used to help building the function. TODO: Deprecate this?

type (optional) allows you to set the type of the route. sync, for functions whose response are sent back to the requester; orasync, for functions that are started and return a call ID to customer while it executes in background. Default: sync.

memory (optional) allows you to set a maximum memory threshold for this function. If this function exceeds this limit during execution, it is stopped and error message is logged. Default: 128.

timeout (optional) is the maximum time a function will be allowed to run. Default is 30 seconds.

headers (optional) is a set of HTTP headers to be returned in the response of this function calls.

config (optional) is a set of configuration variables to be passed onto the function as environment variables. These configuration options shall override application configuration during functions execution. See Configuration for more information.

expects (optional) a list of config/env vars that are required to run this function. These vars will be used when running/testing locally, if found in your local environment. If these vars are not found, local testing will fail.

Hot functions

hot functions support also adds two extra options to this configuration file.

format (optional) is one of the streaming formats covered at function-format.md.

idle_timeout (optional) is the time in seconds a container will remain alive without receiving any new requests; hot functions will stay alive as long as they receive a request in this interval. Default: 30.

 

 

posted on   荣锋亮  阅读(339)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2014-10-05 p/Invoke工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示