feat: Update all commands to use --ca-dir flag instead of positional argument.
This commit is contained in:
+14
-5
@@ -43,6 +43,7 @@ function make_ca() {
|
||||
# CA defaults to the main CA if not specified, but can be overridden with --issuing-ca
|
||||
local CA_FILE_PREFIX="ca"
|
||||
local AIA_BASE_URL=""
|
||||
local CA_DIR=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@@ -74,16 +75,23 @@ function make_ca() {
|
||||
AIA_BASE_URL="$2"
|
||||
shift 2
|
||||
;;
|
||||
--ca-dir)
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "ERROR: Missing value for --ca-dir." >&2
|
||||
return 1
|
||||
fi
|
||||
CA_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Use the provided directory argument
|
||||
local CA_DIR="$1"
|
||||
local CA_NAME="$2"
|
||||
shift 2
|
||||
local CA_NAME="$1"
|
||||
shift 1
|
||||
CA_DIR="${CA_DIR:-${SIMPLE_CA_DIR:-$(pwd)}}"
|
||||
|
||||
if [[ -z "$CA_DIR" || ! -d "$CA_DIR" ]]; then
|
||||
echo "ERROR: Certificate directory $CA_DIR does not exist."
|
||||
@@ -231,7 +239,7 @@ function make_cert() {
|
||||
local CERT_SUBJECT_NAME="$2"
|
||||
shift 2
|
||||
|
||||
CA_DIR="${CA_DIR:-$CERT_DIR}"
|
||||
CA_DIR="${CA_DIR:-${SIMPLE_CA_DIR:-$(pwd)}}"
|
||||
|
||||
local AIA_BASE_URL_FILE="$CA_DIR/aia_base_url.txt"
|
||||
local AIA_URL=""
|
||||
@@ -371,6 +379,7 @@ function make_pfx() {
|
||||
esac
|
||||
done
|
||||
|
||||
CA_DIR="${CA_DIR:-${SIMPLE_CA_DIR:-$(pwd)}}"
|
||||
local ROOT_CA_CERT="ca_cert.pem"
|
||||
local ROOT_CA_KEY="ca_key.pem"
|
||||
local CA_CERT="${CA_FILE_PREFIX:-ca}_cert.pem"
|
||||
|
||||
Reference in New Issue
Block a user