ehough/docker-nfs-server

Single quotes not removed from export environment variables

shayaantx opened this issue · 2 comments

Hi,

I had a docker compose block below and the first single quote was preventing the directory from being read which resulted in "WARNING: skipping NFS_EXPORT_0 environment variable since '/downloads is not a container directory"

    environment:
      - NFS_EXPORT_0='/downloads *(ro,all_squash)'

The culprit code is below:

local dir="${line_as_array[0]}"

if [[ ! -d "$dir" ]]; then

We can strip the single quotes easily (see below), lemme know, and I can put up a PR if you want. Might want to consider also stripping double quotes. Or we could make the change against the $line variable before we try to read it into an array.

local dir="${line_as_array[0]//\'/}"

Or lemme know if I'm missing something obvious here.

Thanks

Actually the same single quote stripping would need to happen in the below code too, so probably best to strip single/double quotes right after reading the environment variable

echo "$exports" > $PATH_FILE_ETC_EXPORTS

nvm I should be wrapping the entire environment variable (including the key in single or double quotes)