Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to save environment variable in SEPAL ? #251

Open
12rambau opened this issue Nov 29, 2022 · 1 comment
Open

how to save environment variable in SEPAL ? #251

12rambau opened this issue Nov 29, 2022 · 1 comment

Comments

@12rambau
Copy link
Member

In the test suit of sepal-ui I need to set some parameters in the environment such as a earthengine token and planet credentials. So far we were creating a .bash_profile file to do this.

Recently I was scanning the hidden files of the new home folder and found a .profile one:

In https://sepal-ui.readthedocs.io/en/latest/start/contribute.html#env-for-planet-components we suggest to create a .bash_profile file to the developers of the lib. It should work on local computers but will break SEPAL instances initialization.

Looking at the .profile in my account I found:

 # ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

meaning that if .bash_profile exist then the bins are not correctly instanciated (and the coloring and other prettifying stuff) right ?

If I want to permanently add extra environment variable instead of eporting them all the time, should I copy/paste this content in my .bash_profile (with the risk of missing any update) or is there another way ?

@TmtStss
Copy link

TmtStss commented Jan 26, 2023

As a frequent Sepal user, I back up the need for being able to use environment variables.

So far, it looks I have a denied permission to add environment variables to the .bashrc file. When I try to edit the .bashrc file in the shell text editor it also mentions: 'File is unwriteable'. See example code here below.

sepal-user@xxxxxxxxx:~$ echo "export DATACUBE_LOCATION='/path/to/datacube'" >> ~/.bashrc
-bash: /home/sepal-user/.bashrc: Permission denied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants