I am using LocalSymbol
to store some database credentials. I put a statement like this in a user-level autoload package:
$PostgresCredentials = LocalSymbol @ "DefaultPostgres";
This returns unevaluated when this package is autoloaded (i.e. it evaluates to LocalSymbol @ "DefaultPostgres"
). Evaluate
does not fix the issue.
If I reload the package manually after my session has started, then $PostgresCredentials
correctly pulls the LocalSymbol
. And of course if I define it with SetDelayed
it will work.
I am just wondering what the problem is. Is it possible to access a LocalSymbol
at the autoload stage?
.m
file to/from$UserBaseDirectory/ApplicationData/YourPackageName
. UsePut
/Get
to do this, notExport
/Import
.Export
/Import
does not work during initiailzation. A nice way is to just put an association with string keys into that.m
file. $\endgroup$LocalSymbol
has trouble with paths that contain spaces. Windows encourages usernames with spaces, which means that LocalSymbol's default storage location will often have spaces on Windows ... $\endgroup$Get
suggestion instead. $\endgroup$