Open ThomasTJdev opened 4 years ago
I was thinking a lot about the config in general, I think this can be changed from INI to JSON Pretty-Printed.
JSON
packedjson
optionally increases performance.INI
key\n
instead of "key": ""
that confuses some people.How to Validate config as-you-type on the fly?.
parseJson
.Note
Hi @juancarlospaco
Of course it would benefit performance and security by doing it on compile-time, but it would also limit the users possibility to do quick adjustments. If they get a new mail server, they then need to change the config and re-compile NimWC. I do have have NimWC running on devices, where Nim is not installed. I would like to keep main options as runtime. If we have static elements in the config, a simple macro looping through could do the job:
macro genConfigItems(): void =
var heading: string
loop through config file:
if line.substr(0, 0) == "[":
heading = line
conintue
if heading in ["static", "config", "nochange"]:
source &= "const cfg" & itemName & " = " & itemValue
else:
source &= "let " & itemName & " = dict.getSectionValue(\"" & heading & "\",\"" & itemValue & "\")\n"
result = parseStmt(source)
I get the point and I see the benefits. But I'm in doubt about "benefit vs time-to-change"...
As you say, the INI does not support types such as bool and int, so it would ease our job as developers to use JSON. But I think our main purpose is to ensure the ease for the end-user.
So I am kinda using webgui
as a Mine Field for cool new ideas, and I think people like them,
so maybe in the future stuff from webgui
can be steal to here, so few destacable mentions can be:
compileTime = true
or compileTime = false
, faster and less code, maybe an overload without requiring a configObject
can be added.But I wait to see how Fusion evolves, maybe cool stuff can be sent there, and only depend on Fusion and the rest just move it inside NimWC, maybe Fusion becomes a frequently installed package and lots of people will have it installed, looks like a nice idea.
Also: https://github.com/juancarlospaco/nim_packages_security_audit#fully-automated-nim-packages-security-audit :slightly_smiling_face:
title*
is defined in the const-file for strings, but thetitle*
should be updated with the value specified by the user inconfig.cfg
. Otherwisetitle
will always be "Nim Website Creator". The plugins needs to be able to usetitle
to represent the user defined title.https://github.com/ThomasTJdev/nim_websitecreator/blob/d22fc86aa934ee3286b8fa5c4c046f3c90fc4bbe/nimwcpkg/constants/_strings.nim#L48