# Copyright (c) 2024, JINGROW
# For license information, please see license.txt


import jingrow


def execute():
	secret_keys = jingrow.get_all(
		"Site Config Key", filters={"type": "Password"}, pluck="key"
	)

	site_config_keys_that_should_be_secret = jingrow.get_all(
		"Site Config", filters={"key": ("in", secret_keys)}, pluck="name"
	)

	for key in site_config_keys_that_should_be_secret:
		jingrow.db.set_value("Site Config", key, "type", "Password")

	common_site_config_keys_that_should_be_secret = jingrow.get_all(
		"Common Site Config", filters={"key": ("in", secret_keys)}, pluck="name"
	)

	for key in common_site_config_keys_that_should_be_secret:
		jingrow.db.set_value("Common Site Config", key, "type", "Password")
