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

Starship ignores STARSHIP_CONFIG environment variable on startup #5994

Closed
ddmytrenko opened this issue May 23, 2024 · 3 comments
Closed

Starship ignores STARSHIP_CONFIG environment variable on startup #5994

ddmytrenko opened this issue May 23, 2024 · 3 comments
Labels
🐛 bug Something isn't working as expected.

Comments

@ddmytrenko
Copy link

According to the documentation:

You can change default configuration file location with STARSHIP_CONFIG environment variable.

Here is my example.

Check STARSHIP_CONFIG environment variable:

$ echo $STARSHIP_CONFIG
/Users/ddmytrenko/.config/zsh/starship/config.toml

Check $STARSHIP_CONFIG content:

$ cat $STARSHIP_CONFIG
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'

# Inserts a blank line between shell prompts
add_newline = true

# Timeout for commands executed by starship (in milliseconds).
command_timeout = 3600000

# Ignore global command_timeout setting and keep running external commands, no matter how long they take.
ignore_timeout = true

# Timeout for starship to scan files (in milliseconds).
scan_timeout = 500

Check the loaded config using starship itself:

$ starship print-config | ag timeout
scan_timeout = 30
command_timeout = 500

So, as we see here, the $STARSHIP_CONFIG file was totally ignored and therefore starship uses default values instead. I always get command timeout warnings because of that. And this is really ANNOYING to be honest.

Starship version:

$ starship --version
starship 1.19.0
branch:
commit_hash:
build_time:2024-05-15 17:06:13 +00:00
build_env:rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew),

ZSH version:

$ zsh --version
zsh 5.8.1 (x86_64-apple-darwin21.0)
@davidkna
Copy link
Member

Please make sure that the variable is exported.

@ddmytrenko
Copy link
Author

ddmytrenko commented May 23, 2024

@davidkna Hm, sure, looks like it was not exported:

$ declare -p STARSHIP_CONFIG
typeset STARSHIP_CONFIG=/Users/ddmytrenko/.config/zsh/starship/config.toml

Ok!
I have exported starship environment variables explicitly right before starship initialisation in my zsh config:

export STARSHIP_CONFIG="$ZDOTDIR/starship/config.toml"
export STARSHIP_CACHE="$ZDOTDIR/starship/cache"
eval "$(starship init zsh)"

Variables are now exported:

$ declare -p | ag STARSHIP_C | ag export
export STARSHIP_CACHE=/Users/ddmytrenko/.config/zsh/starship/cache
export STARSHIP_CONFIG=/Users/ddmytrenko/.config/zsh/starship/config.toml

Now it loads the config properly. Thanks for your advice!

@ddmytrenko
Copy link
Author

Solution:
Export starship environment variables explicitly right before starship initialisation in your ZSH config:

export STARSHIP_CONFIG="$ZDOTDIR/starship/config.toml"
export STARSHIP_CACHE="$ZDOTDIR/starship/cache"
eval "$(starship init zsh)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

2 participants