package com.agent.management.config;

import com.agent.management.repository.json.JsonStore;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.nio.file.Paths;

/**
 * JSON 文件存储配置
 *
 * 数据目录默认与 H2 数据库同级：{工作目录}/data/json/
 */
@Configuration
public class JsonStoreConfig {

    @Bean
    public JsonStore jsonStore(@Value("${app.json-store-dir:./data/json}") String dir) {
        return new JsonStore(Paths.get(dir));
    }
}
