# create status and access for geneweb and gwsetup if not existing
# set domain if empty

my $rec;

for my $service ( qw( geneweb gwsetup ) ) {
    if ( $rec = $DB->get($service) ) {
	if ( ! $rec->prop('status') ) {
	    $rec->set_prop('status', 'disabled');
	}
	if ( ! $rec->prop('access') ) {
	    $rec->set_prop('access', 'private');
	}
	if ( ! $rec->prop('domain') ) {
	    $rec->set_prop('domain', $service . '.' .
		($DB->get('DomainName')->value() || ''));
	}
	# change TCPPort attributes to TcpPort
	if ( $rec->prop('TCPPort') ) {
	    $rec->set_prop('TcpPort', ($DB->get('TCPPort')->value() || ''));
	    $DB->delete_prop($service,'TCPPort');
	}
    }
}

# move only IP from geneweb to gwsetup if existing

my $ip  = $DB->get_prop('geneweb', 'only');
my $ip2 = $DB->get_prop('gwsetup', 'only');

if ( $ip and ! $ip2 ) {
    $DB->delete_prop('geneweb','only');
    ($DB->get('gwsetup'))->set_prop('only', $ip);
}

