screeps / launcher

ISC License
24 stars 25 forks source link

Allow STEAM_API_KEY to be a command-line arg for headless/automated builds #8

Open ewrogers opened 6 years ago

ewrogers commented 6 years ago

The combination of npx and prompt library does not play nice when trying to run npx screeps init in a Docker build. It also does not work inside a Docker container either (prompt is never shown, hangs).

It would be ideal if a command-line arg --steam-api-key <key> could be passed in to init (or allow that step to be skipped).

This is pretty much the only blocker so far to a proper containerized screeps build.

tedivm commented 6 years ago

Would this work? I haven't tried it in docker but it's how I handle my own automated screeps builds.

yes STEAM_KEY | npx screeps init

ewrogers commented 6 years ago

Interesting, the one thing I didn't try! I've just made an init.sh script:

EDIT: Did try the yes STEAM_KEY | npx screeps init with the same issue.

echo 'Copying initial world state...'
cp -avr ./node_modules/@screeps/launcher/init_dist/. .

if [ -n $STEAM_API_KEY ]
then
  sed -i "s/{{STEAM_KEY}}/$STEAM_API_KEY/g" .screepsrc
fi
scitor commented 6 years ago

Please use ENV variables for such things (when you can't use config files), since you can see the command line args in the process list, which would be a security issue.