# -*- coding: utf-8 -*-
# Copyright (c) 2021, JINGROW
# For license information, please see license.txt


import jingrow


def execute():
	jingrow.reload_pg("jcloude", "doctype", "erpnext_app")
	jingrow.reload_pg("jcloude", "doctype", "jcloude_settings")
	jingrow.clear_cache()
	jcloude_settings = jingrow.get_pg("Press Settings", "Press Settings")
	if not jcloude_settings.get("cluster"):
		jcloude_settings.cluster = jingrow.db.get_value(
			"Root Domain", jcloude_settings.domain, "default_cluster"
		)
		jcloude_settings.save()
