• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.6 not reading dotenv

Clyfe

New Member
Joined
Aug 24, 2024
Messages
4
Reaction score
0
Hi Guys, I've compiled the source of TFS1.6 from Git Branch. I haven't made changes and I think I have configured everything correctly but seems that the server isn't reading the env file.
When I run the .exe I receive this message:

1733017904410.webp

But I have put the .env on root directory (Same that config.lua):
1733017946605.webp

I can't find anyone with same issue...
 
Create a new user in database specifically for your server, It also appears that the server itself is trying to use the username forgottenserver not root. Be sure that that is the file being used for the connection.
 
Create a new user in database specifically for your server, It also appears that the server itself is trying to use the username forgottenserver not root. Be sure that that is the file being used for the connection.
If I create an user called "forgottenserver" I can connect but the problem is that the server isn't reading the .env

The server uses a function "getEnv"1733063277190.webp

The function return the env value if it exists, if not it returns "forgottenserver"
1733063320330.webp

But IDK why this is happening
 
Try putting the MySQL information in “ “ I don’t have 1.6 yet so I’m not positive but given that it is in “” in c++ and typically is in “ “ in all the previous distro. Maybe it’s just ignoring it. I’m not sure why it wouldn’t throw an error. But it is searching for a strong.
 
but seems that the server isn't reading the env file.
I think it works this way. TFS uses simple std::getenv to load environment variables from system:
not some advanced library to process .env files etc. (like PHP, Python and NodeJS frameworks do)

looks like mistake. I also assumed that all I have to do is to rename it to .env and set my variables, but it does not work that way.
You got to copy these variables and execute them in terminal, to set them as temporary env variables.

I've reported that problem:
It will be changed to first reading config from config.lua and then overwriting it by environment variables if they are defined - (still not .env file).
After that change database config will be back in config.lua.

FOR NOW you must define your mysql config in config.lua (it will overwrite any env variables):
Code:
mysqlHost = "127.0.0.1"
mysqlUser= "root"
mysqlPass= ""
mysqlDatabase= "tfs_dbmasters"
mysqlSock= ""
mysqlPort= 3306
 
Last edited:
I think it works this way. TFS uses simple std::getenv to load environment variables from system:
not some advanced library to process .env files etc. (like PHP, Python and NodeJS frameworks do)

looks like mistake. I also assumed that all I have to do is to rename it to .env and set my variables, but it does not work that way.
You got to copy these variables and execute them in terminal, to set them as temporary env variables.

I've reported that problem:
It will be changed to first reading config from config.lua and then overwriting it by environment variables if they are defined - (still not .env file).
After that change database config will be back in config.lua.

FOR NOW you must define your mysql config in config.lua (it will overwrite any env variables):
Code:
mysqlHost = "127.0.0.1"
mysqlUser= "root"
mysqlPass= ""
mysqlDatabase= "tfs_dbmasters"
mysqlSock= ""
mysqlPort= 3306
Ohh I see it. Thanks for your help. I'll do it :D
 
Back
Top