Skip to content

gen_env.sh main branch上的版本不能生成default_chatbot_user.txt #8

@heqiqi

Description

@heqiqi

在private llm chabot repo里集成了此项目main branch上的版本,但是main branch上的sh 不能自动创建用户。 所以,还请添加如下代码:
`

add default user/password

DynamoDB table name

table_name="chatbotFE_user"
region=$2
username="admin"
email="[email protected]"
status="active"
createtime=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")

Generate a random 6 character password

password=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 9 | head -n 1)
group="admin"

Items to add

item='{"username": {"S": "'"$username"'"}, "password": {"S": "'"$password"'"}, "groupname": {"S": "'"admin"'"}, "email": {"S": "'"$email"'"},"status": {"S": "'"$status"'"},"createtime": {"S": "'"$createtime"'"}}'

Add items

aws dynamodb put-item
--table-name "$table_name"
--item "$item" --region "$region"

Check the exit status of the AWS CLI command

if [ $? -ne 0 ]; then
echo "Error: Failed to add item to DynamoDB table."
exit 1
fi

echo "Item added successfully. username:${username},password:${password}, write to file ./default_chatbot_user.txt"
echo "username:${username},password:${password}" >> default_chatbot_user.txt
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions