001/*
002 * Copyright 2025 devteam@scivics-lab.com
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing,
011 * software distributed under the License is distributed on an
012 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied.  See the License for the
014 * specific language governing permissions and limitations
015 * under the License.
016 */
017
018package com.scivicslab.actoriac;
019
020/**
021 * Configuration for HashiCorp Vault connection.
022 *
023 * @author devteam@scivics-lab.com
024 */
025public class VaultConfig {
026    private final String address;
027    private final String token;
028
029    /**
030     * Creates a new VaultConfig.
031     *
032     * @param address Vault server address (e.g., "http://127.0.0.1:8200")
033     * @param token Vault authentication token
034     */
035    public VaultConfig(String address, String token) {
036        if (address == null || address.isEmpty()) {
037            throw new IllegalArgumentException("Vault address cannot be null or empty");
038        }
039        if (token == null || token.isEmpty()) {
040            throw new IllegalArgumentException("Vault token cannot be null or empty");
041        }
042        this.address = address.endsWith("/") ? address.substring(0, address.length() - 1) : address;
043        this.token = token;
044    }
045
046    /**
047     * Gets the Vault server address.
048     *
049     * @return Vault server address
050     */
051    public String getAddress() {
052        return address;
053    }
054
055    /**
056     * Gets the Vault authentication token.
057     *
058     * @return Vault token
059     */
060    public String getToken() {
061        return token;
062    }
063
064    @Override
065    public String toString() {
066        return "VaultConfig{address='" + address + "', token='***'}";
067    }
068}