import * as dotenv from 'dotenv'
import * as path from 'path'

dotenv.config({ path: path.join(__dirname, '../', '.env') })

interface Config {
	ad: {
		id: string
		url: string
		bindDn: string
		bindCreds: string
		searchBase: string
	}[]
	appUrl: string
	db: {
		host: string
		user: string
		password: string
		name: string
		names: string[]
	}
	env: string
	mail: {
		host: string
		username: string
		password: string
	}
	port: string
	externalProductionSchema: string
}
export default <Config>{
	ad: [
		{
			id: process.env.AD_ID,
			url: process.env.AD_URL,
			bindDn: process.env.AD_BIND_DN,
			bindCreds: process.env.AD_BIND_CREDS,
			searchBase: process.env.AD_SEARCH_BASE
		},
		{
			id: process.env.SECOND_AD_ID,
			url: process.env.SECOND_AD_URL,
			bindDn: process.env.SECOND_AD_BIND_DN,
			bindCreds: process.env.SECOND_AD_BIND_CREDS,
			searchBase: process.env.SECOND_AD_SEARCH_BASE
		}
	],
	appUrl: process.env.APP_URL,
	db: {
		host: process.env.DB_HOST,
		user: process.env.DB_USER,
		password: process.env.DB_PASSWORD,
		name: process.env.DB_NAME,
		names: [
			process.env.DB_NAME_PROTO,
			process.env.DB_NAME_STACKER,
			process.env.DB_NAME_EVAL
		]
	},
	env: process.env.NODE_ENV,
	mail: {
		host: process.env.MAIL_HOST,
		username: process.env.MAIL_USERNAME,
		password: process.env.MAIL_PASSWORD
	},
	port: process.env.PORT,
	externalProductionSchema: 'EXTPROD'
}