package com.gentics.mesh.demo;

import com.gentics.mesh.Mesh;
import com.gentics.mesh.demo.verticle.CustomerVerticle;
import com.gentics.mesh.etc.OptionsLoader;
import com.gentics.mesh.etc.config.MeshOptions;
import com.gentics.mesh.util.DeploymentUtil;
import com.gentics.mesh.verticle.admin.AdminGUIVerticle;

import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.logging.SLF4JLogDelegateFactory;

/**
 * Main runner that is used to deploy a preconfigured set of verticles.
 */
public class DemoRunner {

	static {
		// Use slf4j instead of jul
		System.setProperty(LoggerFactory.LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
		System.setProperty("vertx.httpServiceFactory.cacheDir", "tmp");
		System.setProperty("vertx.cacheDirBase", "tmp");
	}

	public static void main(String[] args) throws Exception {
		MeshOptions options = OptionsLoader.createOrloadOptions();
		Mesh mesh = Mesh.mesh(options);
		mesh.setCustomLoader((vertx) -> {
			JsonObject config = new JsonObject();
			config.put("port", 8080);
			DeploymentUtil.deployAndWait(vertx, config, CustomerVerticle.class);
			DeploymentUtil.deployAndWait(vertx, config, AdminGUIVerticle.class);
		});
		mesh.run();
	}
}

@@ -943,16 +943,137 @@
 ions();%0A
+%09%09options.getHttpServerOptions().setEnableCors(true);%0A%09%09options.getHttpServerOptions().setCorsAllowedOriginPattern(%22*%22);%0A
 %09%09Mesh m

Enable cors for the demo