On Tue, 02 Jun 2020 at 08:41:28, Frédéric Mangano-Tarumi wrote: > > Saying ${AUR_CONFIG}.defaults here is elegant, short, precise and clear > > to everybody who is familiar with the code base. However, given that > > those comments are mainly relevant to new contributors setting up a dev > > environment, I am not sure whether mentioning $AUR_CONFIG is a good idea > > here (people might not be aware of what exactly it is used for at this > > point). How about just saying config.defaults, given that the file is in > > the same directory? While being less precise, most people should still > > understand which file is referred to. > > Developers need to set AUR_CONFIG to spawn aurweb. If we introduced it > earlier like \u201cDefine the path to you configuration: > export AUR_CONFIG="\u2026"\u201d, I think it should fit.
That's better, even though I still don't believe it's more useful than just saying, config.defaults here. New users might set things up, then go back to the config the next day without knowing about $AUR_CONFIG anymore. > As you implied though, using anything other than conf/config is madness. > How about making aurweb.spawn set AUR_CONFIG to, by order of preference: > > 1. $AUR_CONFIG, if already defined, > 2. $PWD/conf/config, if it exists, > 3. $parent/conf/config where $parent is the nearest parent directory > such that the file exists. > > aurweb.spawn is only meant for development, and it spawns test servers, > so I think it makes sense to use a different default for AUR_CONFIG than > production. Sounds reasonable. I would prefer to infer the path from the location of the script itself (__file__) instead of (2) and (3) though. > I can replace $AUR_ROOT by YOUR_AUR_ROOT, which is more explicit, and > remove the comment. In TESTING, we can suggest using the following > command: > sed -e "s;YOUR_AUR_ROOT;$PWD;g" conf/config.dev > conf/config Sounds good. > With more motivation, we could add support for environment variable > interpolation in INI\u202ffiles. aurweb.config would know AUR_ROOT as a > by-product of finding AUR_CONFIG, if we implement that. Yeah, probably not worthwhile for just this one use case but something we might want to look into in the future. I am not sure what "aurweb.config would know AUR_ROOT as a by-product of finding AUR_CONFIG" means exactly but note that AUR_CONFIG is usually not contained in the document root in production setups. > I meant it to make the SQLite block stand out next to MySQL, but it does > look special compared to other sections. > > In config.defaults, we use newlines only between sections, but that > doesn\u2019t leave much room for documentation. Interleaving comments with > variables like I did below is okay only because the section is tiny. If > the file grew bigger, I wish the norm was \u201cblock of documentation + set > of correlated variable definitions + new line\u201d. Sections would need a > special comment to make them visible, like a ruler or a frame. I would hope that each section would correspond to exactly one set of correlated variable definitions, so we would not need this. I am aware that that's currently not the case though. > > I think we usually don't add modelines or any other editor-specific > > configuration. > > Ok! Thanks!