let path = require('path');

let apos = require('apostrophe')({
	// Export for apostrophe-monitor which manages restarting the apostrophe system (not the whole nodeJS process) when changes are made.
	// See https://github.com/apostrophecms/apostrophe-monitor
	root: module,
	
	shortName: 'avusd',
	
	// See lib/modules for basic project-level configuration of our modules
	// responsible for serving static assets, managing page templates and
	// configuring user accounts.
	
	modules: {
		'two-column-widgets': {extend: 'apostrophe-widgets'},
		'two-column-1-2-widgets': {},
		'two-column-2-1-widgets': {},
		'theme': {},
		
		
		// Apostrophe module configuration
		
		// Note: most configuration occurs in the respective
		// modules' directories. See lib/apostrophe-assets/index.js for an example.
		
		// However any modules that are not present by default in Apostrophe must at
		// least have a minimal configuration here: `moduleName: {}`
		
		// If a template is not found somewhere else, serve it from the top-level
		// `views/` folder of the project
		
		'apostrophe-templates': {viewsFolderFallback: path.join(__dirname, 'views')},
		
		'apostrophe-express': {
			'session': {
				'secret': "ajg8zx734t6JS3nJxUJH5^9s34l12xci*JKDm wernDhqlL",
			},
		},
		'apostrophe-assets': {
			minify: (process.env.ENV === 'prod')
		},
		'apostrophe-db': {
			uri: process.env.MONGO_URL
		},
		'apostrophe-rich-text-permalinks': {
			join: {
				withType: ["apostrophe-page", "apostrophe-file"]
			}
		},


		//Note: Rich Text Widgets configuration is being done in the /lib/modules/apostrophe-rich-text-widgets/index.js
		//
		// 'apostrophe-rich-text-widgets': {
		// 	sanitizeHtml: {
		// 		allowedAttributes: {
		// 			'p': ['apos-indent1', 'apos-indent2']
		// 		},
		// 		allowedClasses: {
		// 			'p': ['apos-indent1', 'apos-indent2'],
		// 			'p': ['testClass']
		// 		}
		// 	}
		// }


		// Was having some issues with the menus hovering over the text the user was editing.  Is less functional but better looking.
		//'apostrophe-tiptap-rich-text-widgets': {}
	}
});

// Export for apostrophe-monitor which manages restarting the apostrophe system (not the whole nodeJS process) when changes are made.
// See https://github.com/apostrophecms/apostrophe-monitor
module.exports = apos;
