Vaultwarden Wiki 中文版
⮐ Vaultwarden Wiki个人主页联系我
  • 关于
  • 首页
  • FAQ
    • 1.FAQ
    • 2.审计
    • 故障排除
      • 1.Bitwarden Android 故障排除
  • 容器镜像的使用
    • 1.容器镜像的选择
    • 2.启动容器
    • 3.更新 Vaultwarden 镜像
    • 4.使用 Docker Compose
    • 5.使用 Podman
  • 部署
    • 1.构建您自己的镜像
    • 2.构建二进制
    • 3.预构建二进制
    • 4.第三方包
    • 5.部署示例
    • 6.代理示例
    • 7.转储示例
    • HTTPS
      • 1.启用 HTTPS
      • 2.使用 Let's Encrypt 证书运行私有 Vaultwarden 实例
  • 配置
    • 1.配置概述
    • 2.禁用新用户注册
    • 3.禁用邀请
    • 4.启用管理页面
    • 5.禁用管理令牌
    • 6.启用 WebSocket 通知
    • 7.启用移动客户端推送通知
    • 8.启用 U2F 和 FIDO2 WebAuthn 身份验证
    • 9.启用 YubiKey OTP 身份验证
    • 10.更改持久性数据位置
    • 11.更改 API 请求大小限制
    • 12.更改 worker 数量
    • 13.SMTP 配置
    • 14.显示密码提示
    • 15.禁用或覆盖密码库接口托管
    • 16.日志记录
    • 17.设置为 systemd 服务
    • 18.从 LDAP 同步用户
    • 19.使用备用基本目录(子目录/子路径)
    • 20.其他配置
    • *使用 systemd docker 运行
    • 数据库
      • 1.使用 MariaDB (MySQL) 后端
      • 2.使用 PostgreSQL 后端
      • 3.在未启用 WAL 的情况下运行
      • 4.从 MariaDB (MySQL) 迁移到 SQLite
    • 安全
      • 1.强化指南
      • 2.Fail2ban 设置
      • 3.Docker Traefik ModSecurity 设置
    • 其他
      • 1.翻译电子邮件模板
      • 2.翻译管理页面
      • 3.自定义 Vaultwarden CSS
  • 备份
    • 1.通用(非 docker)
  • 其他
    • 1.从 Keepass 或 KeepassX 导入数据
    • 2.备份您的密码库
    • 3.与上游 API 实现的区别
    • 4.支持上游的发展
    • 5.使用 Cloudflare DNS 的 Caddy 2.x
    • 6.Git hooks
    • *使用非 root 用户运行 docker 容器
    • *使私有 CA 和自签名证书兼容 Chrome
    • *测试 SSO
由 GitBook 提供支持
在本页
  • pre-commit
  • commit-msg
  1. 其他

6.Git hooks

上一页5.使用 Cloudflare DNS 的 Caddy 2.x下一页*使用非 root 用户运行 docker 容器

最后更新于1个月前

对应的

以下提交 hooks 可能对您有所帮助,请自行斟酌使用。

pre-commit

#!/bin/bash

HAS_ISSUES=0
FIRST_FILE=1

colerr="$(tput setaf 9)"
colok="$(tput setaf 10)"
colreset="$(tput sgr0)"

for file in $(git diff --name-only --staged); do
    FMT_RESULT="$(rustfmt --edition 2021 --check --quiet $file 2>/dev/null || true)"
    if [ "$FMT_RESULT" != "" ]; then
        if [ $FIRST_FILE -eq 0 ]; then
            echo -n ", "
        fi
        echo -n "${colerr}${file}${colreset}"
        HAS_ISSUES=1
        FIRST_FILE=0
    fi
done

if [ $HAS_ISSUES -eq 0 ]; then
    exit 0
fi

echo "."
echo "Your code has formatting issues in the files listed above."
echo "Format your code with: ${colok}cargo fmt --all --${colreset}"
exit 1

commit-msg

#!/bin/bash

HAS_ISSUES=0
MSG_FILE="$1"

colerr="$(tput setaf 9)"
colok="$(tput setaf 10)"
colreset="$(tput sgr0)"

MSG=`cat "$MSG_FILE" |grep -v -E "^$" |grep  -v -E "^#" |head -1`

if [ "`cat "$MSG_FILE" |grep -v -E "^$" |grep  -v -E "^#" |wc -l`" -gt 1 ]; then
	LINE2=`cat "$MSG_FILE" |grep  -v -E "^#" |head -2 |tail -1`
	if [ "$LINE2" != "" ]; then
		HAS_ISSUES=1
	fi
fi

echo $MSG |grep -qE '^(feat|fix|docs|style|refactor|perf|test|build|chore|revert|ci)(\(.+\))?!?: .*[^ ]$'

if [ "$?" != "0" ]; then
	HAS_ISSUES=1
fi

if [ $HAS_ISSUES -eq 0 ]; then
    exit 0
fi

echo "The commit message must follow the Conventional Commits specification:"
echo ""
echo "----------------------------------------------------------------------"
echo "${colok}type${colreset}[(optional scope)]: description"
echo ""
echo "[optional body]"
echo ""
echo "[optional footer(s)]"
echo "----------------------------------------------------------------------"
echo ""
echo "Where ${colok}type${colreset} must be one of:"
echo ""
echo "${colok}feat     ${colreset}| Features                 | A new feature"
echo "${colok}fix      ${colreset}| Bug Fixes                | A bug fix"
echo "${colok}docs     ${colreset}| Documentation            | Documentation only changes"
echo "${colok}style    ${colreset}| Styles                   | Changes that do not affect the meaning of the code (white-space, formatting)"
echo "${colok}refactor ${colreset}| Code Refactoring         | A code change that neither fixes a bug nor adds a feature"
echo "${colok}perf     ${colreset}| Performance Improvements | A code change that improves performance"
echo "${colok}test     ${colreset}| Tests                    | Adding missing tests or correcting existing tests"
echo "${colok}build    ${colreset}| Builds                   | Changes that affect the build system or external dependencies"
echo "${colok}ci       ${colreset}| Continuous Integrations  | Changes to our CI configuration files and scripts"
echo "${colok}chore    ${colreset}| Chores                   | Other changes that don't modify src or test files"
echo "${colok}revert   ${colreset}| Reverts                  | Reverts a previous commit"
echo ""
echo "Read the full specification here: https://www.conventionalcommits.org/en/v1.0.0/"
exit 1
官方页面地址