I had a problem about deploying to FreeBSD earlier and was resolved.
This time, I have an executable built by issuing "cargo build --release".
If I execute it on the directory location at ..."target/release" by issuing "./hello_server" or "./hello_server &" it ran without any problem.
However, when I try to start it using FreeBSD's rc.d system using the script below:
#!/bin/sh
. /etc/rc.subr
name=rustapps
rcvar=rustapps_enablestart_cmd="${name}_start"
stop_cmd=":"load_rc_config $name
: ${rustapps_enable:=no}
: ${rustapps_msg="Nothing started."}rustapps_start()
{
/usr/local/rustapps/hello_server/target/release/hello_server &
}run_rc_command "$1"
It presented me with "DATABASE_URL must be set: NotPresent" panic. Clearly, it is not reading the .env variables.
How can I resolve this problem? I need the app to start using FreeBSD rc.d script. Thanks!