Skip to content

Commit

Permalink
add variable.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
rsonghuster committed Aug 8, 2024
1 parent 5bdc6d1 commit cb15799
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
3 changes: 2 additions & 1 deletion web-framework/python/flask/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Project
Name: start-fc-flask
Provider:
- 阿里云
Version: 0.0.5
Version: 0.0.7
Description: 本案例将Flask框架,这一非常受欢迎的Python Web框架,快捷创建并部署到阿里云函数计算 FC。
HomePage: https://github.com/devsapp/start-web-framework
Organization: 阿里云函数计算(FC)
Expand Down Expand Up @@ -60,5 +60,6 @@ Parameters:
title: 域名配置
type: string
default: auto
description: 函数计算自定义域名, 如果为 auto,则会下发一个一定有效期的仅支持 http 临时测试域名(切莫用于生产)
required: false
x-domain: true
2 changes: 1 addition & 1 deletion web-framework/python/flask/src/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
framework:
fc-flask:
defaultBuilder:
languages:
- python3.10
Expand Down
30 changes: 11 additions & 19 deletions web-framework/python/flask/src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ access: "{{ access }}"
vars:
region: "{{ region }}"
functionName: "{{ functionName }}"

resources:
framework:
component: fc3
# actions:
# pre-deploy:
# - run: mkdir python
# path: ./code
# - run: pip install -r requirements.txt -t ./python
# path: ./code
fc-flask:
component: fc3@dev
props:
timeout: 60
cpu: 1
Expand All @@ -36,6 +31,8 @@ resources:
PATH: /var/fc/lang/python3.10/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ruby/bin:/opt/bin:/code:/code/bin
PYTHONPATH: /opt/python:/code/python:/code
TZ: Asia/Shanghai
CHAT_API_URL: '{{ chat_api_url }}'
CHAT_API_TOKEN: '{{ chat_api_token }}'
functionName: ${vars.functionName}
code: ./code
layers:
Expand All @@ -50,14 +47,9 @@ resources:
- PUT
- DELETE
authType: anonymous

fc3_domain_0:
component: fc3-domain
props:
region: ${vars.region}
domainName: "{{ domainName }}"
protocol: HTTP
routeConfig:
routes:
- path: /*
functionName: ${vars.functionName}
customDomain:
domainName: "{{ domainName }}"
protocol: HTTP
route:
path: /*
qualifier: LATEST
12 changes: 12 additions & 0 deletions web-framework/python/flask/src/variable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services: #服务变量
fc-flask:
chat_api_url:
title: chat_api_url
type: string
default: 'https://api.openai.com/v1'
description: chat api 服务的 url
chat_api_token:
title:
type: string
sensitive: true
description: chat api 服务的 token

0 comments on commit cb15799

Please sign in to comment.