#!/bin/sh
USERS_DIR=/srv/filebrowser/files/users/

echo "Initializing container" 
/filebrowser config init 
/filebrowser config set --auth.method=$AUTH_METHOD --auth.header=$AUTH_HEADER
    
mkdir -p $USERS_DIR
    

USER=anthonyscorrea@gmail.com
/filebrowser users add $USER "" --perm.admin
/filebrowser users update $USER --scope "users/$USER"
mkdir -p $USERS_DIR$USER
ln -s /srv/foundry/Data/modules $USERS_DIR$USER/foundry-modules
ln -s /srv/foundry/Data/worlds $USERS_DIR$USER/foundry-worlds
ln -s /srv/foundry/Data/systems $USERS_DIR$USER/foundry-systems
ln -s /srv/metube $USERS_DIR$USER/metube
ln -s /srv/foundry/ $USERS_DIR$USER/foundry

USER=bcrase@gmail.com
/filebrowser users add $USER "" 
/filebrowser users update $USER --scope "users/$USER"
mkdir -p $USERS_DIR$USER
ln -s /srv/foundry/Data/worlds $USERS_DIR$USER/foundry-worlds
ln -s /srv/metube $USERS_DIR$USER/metube

USER=acorre20@gmail.com
/filebrowser users add $USER ""
/filebrowser users update $USER --scope "users/$USER"
mkdir -p $USERS_DIR$USER
ln -s /srv/foundry/Data/worlds $USERS_DIR$USER/foundry-worlds

/filebrowser users add $USER ""
/filebrowser users update $USER --scope "users/$USER"
mkdir -p $USERS_DIR$USER


exec "/filebrowser"