import dotenv from 'dotenv';
import * as fs from 'fs';

dotenv.config();

let rawData = fs.readFileSync('variable.json', 'utf8');
let jsonData = JSON.parse(rawData);

// const MYSQL_HOST = process.env.MYSQL_HOST || '192.168.29.101';//127.0.0.1
// const MYSQL_DATABASE = process.env.MYSQL_DATABASE || 'loansystem';
// const MYSQL_USER = process.env.MYSQL_HOST || 'root';//'loansystem_root'
// const MYSQL_PASS = process.env.MYSQL_HOST || 'Native#2021';//'2b*qD21z7'

const MYSQL_HOST = jsonData.MYSQL_HOST;
const MYSQL_DATABASE = jsonData.MYSQL_DATABASE;
const MYSQL_USER = jsonData.MYSQL_USER;
const MYSQL_PASS = jsonData.MYSQL_PASSWORD;
const MYSQL_PORT = jsonData.MYSQL_PORT;

const MYSQL = {
    host: MYSQL_HOST,
    database: MYSQL_DATABASE,
    user: MYSQL_USER,
    pass: MYSQL_PASS,
    port:MYSQL_PORT

};

const SERVER_HOSTNAME = process.env.SERVER_HOSTNAME || 'localhost';
const SERVER_PORT = process.env.PORT || 1403;//process.env.PORT

const SERVER = {
    hostname: SERVER_HOSTNAME,
    port: SERVER_PORT
};

const AWS_ID = process.env.AWS_ID || 'AKIA4UJZ7TJYTMTOL35N';
const AWS_SECRET = process.env.AWS_SECRET || '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';
// const AWS_BUCKET_NAME = process.env.AWS_BUCKET_NAME || 'localhost';

const S3BUCKET = {
    aws_Id: AWS_ID,
    aws_secret: AWS_SECRET,
    region: 'ap-south-1',
};

const BASEREQUST = [
    '/api/roles/getAllRoles',
    '/api/roles/insertRoles',
    '/api/roles/updateRoles',
    '/api/roles/deleteRole',
    '/api/partner/users/login',
    '/api/customer/users/clientVerifyContact',
    '/api/customer/users/checkContactNoExist',
    '/api/admin/users/login',
    '/api/customer/cities/getCityByPincode'
];

const config = {
    mysql: MYSQL,
    s3bucket: S3BUCKET,
    baseRequests: BASEREQUST,
    server: SERVER
};

export default config;
