using Microsoft.Extensions.Configuration;

#region 读配置信息
/// <summary>
/// AccessKeyId
/// </summary>
public readonly string AccessKeyId = "";
/// <summary>
/// AccessKeySecret
/// </summary>
public readonly string AccessKeySecret = "";
/// <summary>
/// Endping
/// </summary>
public readonly string Endping = "";
/// <summary>
/// 桶名
/// </summary>
public readonly string BucketName = "";
/// <summary>
/// 文件目录名 XW_WebFile/
/// </summary>
public readonly string DirectoryName = "";
/// <summary>
/// pg连接字符串
/// </summary>
public readonly string PgConnectionString = "";
#endregion 读配置信息
private readonly IConfiguration _configuration;
public HomeController(IConfiguration configuration)
{
    _configuration = configuration;
    AccessKeyId = _configuration["AccessKeyId"];
    AccessKeySecret = _configuration["AccessKeySecret"];
    Endping = _configuration["Endping"];
    BucketName = _configuration["BucketName"];
    DirectoryName = _configuration["DirectoryName"];
    PgConnectionString = _configuration["ConnectionStrings:PostgreSQL"];
    //构造函数退出后,不能分配 readonly 字段
}