lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Feb 24, 2011 at 1:01 PM, Henderson, Michael D
<michael.d.henderson@lmco.com> wrote:
> I'm having trouble figuring out a best way to write a configuration file with Lua.
>
> I think that something like
>
> batch@raw
>    dev  = account { host = 'rawdev' , name = 'batch01', instance = 'raw' }
>    test = account { host = 'rawtest', name = 'batch11', instance = 'raw' }
>    prod = account { host = 'rawprod', name = 'batch21', instance = 'raw' }
> batch@staging
>    dev  = account { host = 'stgdev' , name = 'batch02', instance = 'staging' }
>    test = account { host = 'stgtest', name = 'batch12', instance = 'staging' }
>    prod = account { host = 'stgprod', name = 'batch22', instance = 'staging' }
>
> would work but that's no longer a configuration file written in Lua.
>

database {
	['batch@raw'] = {
	    dev  = account { host = 'rawdev' , name = 'batch01', instance = 'raw' },
	    test = account { host = 'rawtest', name = 'batch11', instance = 'raw' },
	    prod = account { host = 'rawprod', name = 'batch21', instance = 'raw' },
	},
	['batch@staging'] = {
	   dev  = account { host = 'stgdev' , name = 'batch02', instance = 'staging' },
	   test = account { host = 'stgtest', name = 'batch12', instance = 'staging' },
	   prod = account { host = 'stgprod', name = 'batch22', instance = 'staging' },
	},
}