With bash you may use read
like tis:
#!/usr/bin/env bash
{ IFS= read -rd '' value <config.txt;} 2>/dev/null
printf '%s' "$value"
Notice that:
The last newline is preserved.
The stderr
is silenced to /dev/null
by redirecting the whole commands block, but the return status of the read command is preserved, if one needed to handle read error conditions.