package server;

use warnings;
use strict;


our $ip      = '172.16.10.1';
our $netmask = '255.255.255.0';

our ( $ip_from, $ip_to ) = ( 10, 100 );

our $domain_name = 'pxelator.lan';

our $base_dir = '/srv/pxelator';

use Module::Refresh qw//;
sub refresh { Module::Refresh->refresh };

mkdir $_ foreach grep { ! -e $_ } map { "$base_dir/conf/$server::ip/$_" } ( 'ip', 'mac', 'hostname', 'deploy' );

use File::Slurp;
sub shared {
	my ($name, $value) = @_;

	my $path ="$base_dir/conf/$server::ip/$name";
	if ( defined $value ) {
		write_file $path, $value;
		warn "update $path = $value";
	} else {
		$value = read_file $path if -e $path;
	}
	return $value;
}

sub debug { shared('debug', @_) || 0 }

warn "loaded";

1;
