Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: variable best practice - shared variable for database info #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ access: "{{ access }}"
vars:
region: "{{ region }}"
name: "{{ projectname }}" #这里的 name 是 project name,用于作为资源前缀
db_username: "{{ db_username }}"
db_password: "{{ db_password }}"
db_database: "{{ db_database }}"

resources:
VectorDB:
Expand All @@ -13,9 +16,9 @@ resources:
region: ${vars.region}
name: "{{ db_name }}"
engine: "PostgreSQL:16.0"
database: "{{ db_database }}"
username: "{{ db_username }}"
password: "{{ db_password }}"
database: ${vars.db_database}
username: ${vars.db_username}
password: ${vars.db_password}
vpcID: auto
extensions:
- name: vector
Expand All @@ -39,9 +42,9 @@ resources:
timeout: 3
environmentVariables:
PG_HOST: ${resources.VectorDB.output.host}
PG_USER: ${resources.VectorDB.props.username}
PG_PASSWORD: ${resources.VectorDB.props.password}
PG_DATABASE: ${resources.VectorDB.props.database}
PG_USER: ${vars.db_username}
PG_PASSWORD: ${vars.db_password}
PG_DATABASE: ${vars.db_database}
dimension: '768' #dimension 和 embedding_model 配置要一致
tableName: start_flow_rag_table
code: code/pghelper
Expand Down
16 changes: 16 additions & 0 deletions src/variable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
shared: # 共享变量
db_database:
title: 数据库名称
type: string
default: "flow_rag_database_by_dipper"
description: Postgresql 数据库名称
db_username:
title: 用户名称
type: string
default: "cap"
description: Postgresql 数据库用户名
db_password:
title: 密码
sensitive: true
default: "AwesomeCAP_2024"
description: Postgresql 数据库密码
22 changes: 0 additions & 22 deletions variable.yaml

This file was deleted.