Files
EasyTier/easytier-go/script/generate-proto.sh
T
Luna YaoandClaude Code 250c2ad8d6 refactor(config): preserve explicit flags with FlagsPatch and derive CLI arguments from schema (#2585)
This PR refactors EasyTier's configuration flags system across protobuf definitions, TOML/API persistence, runtime reconciliation, and the CLI.

It introduces a synthesized FlagsPatch protobuf message with optionize and pbjson support to track field presence reliably, replaces manual CLI flag boilerplate with dynamic schema-driven clap argument generation, and
establishes Flags::resolve(patch) as the single source of truth for runtime defaults.

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-10-10 22:11:08 +08:00

45 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
repository_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
easytier_source="${1:-${EASYTIER_SOURCE:-"${repository_root}/.."}}"
proto_root="${easytier_source}/easytier-proto/proto"
if [[ ! -f "${proto_root}/api_instance.proto" ]]; then
echo "EasyTier proto source not found at ${proto_root}" >&2
exit 1
fi
if [[ "$(protoc --version)" != "libprotoc 35.1" && "$(protoc --version)" != "libprotoc 36.1" ]]; then
echo "protoc 35.1 or 36.1 is required" >&2
exit 1
fi
if [[ "$(protoc-gen-go --version)" != "protoc-gen-go v1.36.11" ]]; then
echo "protoc-gen-go v1.36.11 is required" >&2
exit 1
fi
protoc \
-I "${proto_root}" \
--go_out="${repository_root}" \
--go_opt=module=github.com/easytier/easytier/easytier-go \
--go_opt=Mannotations.proto=github.com/easytier/easytier/easytier-go/proto/easytier \
--go_opt=Mcommon.proto=github.com/easytier/easytier/easytier-go/proto/common \
--go_opt=Merror.proto=github.com/easytier/easytier/easytier-go/proto/error \
--go_opt=Macl.proto=github.com/easytier/easytier/easytier-go/proto/acl \
--go_opt=Mpeer_rpc.proto=github.com/easytier/easytier/easytier-go/proto/peer_rpc \
--go_opt=Mapi_instance.proto=github.com/easytier/easytier/easytier-go/proto/api/instance \
--go_opt=Mapi_config.proto=github.com/easytier/easytier/easytier-go/proto/api/config \
--go_opt=Mapi_manage.proto=github.com/easytier/easytier/easytier-go/proto/api/manage \
--go_opt=Mweb.proto=github.com/easytier/easytier/easytier-go/proto/web \
"${proto_root}/annotations.proto" \
"${proto_root}/common.proto" \
"${proto_root}/error.proto" \
"${proto_root}/acl.proto" \
"${proto_root}/peer_rpc.proto" \
"${proto_root}/api_instance.proto" \
"${proto_root}/api_config.proto" \
"${proto_root}/api_manage.proto" \
"${proto_root}/web.proto"