-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#pragma option #204
#pragma option #204
Conversation
Good idea and implementation. |
How can this be used to specify a variable through command-line parameters? I'm using multiple |
This can't, but the normal command-line already can.
|
@Y-Less Thank you! I already throught I read that somewhere but I couldn't find it when I tried to find it later. Now I can finally throw away my hack-ish Not even joking, it looks like this. sed -i "s/#define localmode 1/#define localmode $LOCALMODE/" $CI_PROJECT_DIR/gamemodes/SFCRRPG.pwn
sed -i "s/#define SQL_SERVER \"127.0.0.1\"/#define SQL_SERVER \"$SQL_SERVER\"/" $CI_PROJECT_DIR/include/mysql.inc
sed -i "s/#define SQL_USER \"D3V1Lx\"/#define SQL_USER \"$SQL_USER\"/" $CI_PROJECT_DIR/include/mysql.inc
sed -i "s/#define SQL_DB \"CNRUSERS\"/#define SQL_DB \"$SQL_DB\"/" $CI_PROJECT_DIR/include/mysql.inc
sed -i "s/#define SQL_PASS \"johncena\"/#define SQL_PASS \"$SQL_PASS\"/" $CI_PROJECT_DIR/include/mysql.inc Even looking back at that, I could've easily made multiple replacements with only one sed. But I have only learnt that recently. |
While that is correct, you shouldn't be building usernames and passwords in to scripts like that. Loading those is now one of the best remaining uses for an INI system to store your credentials for connecting to a database. |
You're right, however the binaries containing the username and password are automatically compiled and sent to the server running the gamemode. The credentials itself are saved in GitLab. And if someone were to obtain the AMX, I could just revoke the credentials and issue new ones. |
You shouldn't be storing credentials in git either! |
Not in Git, in GitLab as a protected secret variable. I know very well that you shouldn't store secrets in Git. |
Fixed a bug and added |
#pragma option
Allows you to specify command-line options within a script. Some don't work, some already have other pragma equivalents, but some can't be done yet. Could actually replace a huge number of other pragmas:
Certain options are disabled in this manner, because they would alter details too fundamental, such as input and output files, that can't be changed after you already started reading said files:
Note that it will only read up to about 32 characters from the option, since it isn't really designed for long ones. Speaking of which, a lot of the existing
pragma
code usesi<sizeof name
andname[i]='\0'
, which is technically a buffer overflow, but as far as I can see only ever writes an extra zero in to a subsequently unused variable, so is entirely safe.