0

This question is related to this previous question.

I am able to install private Maven packages available on GitHub packages with the following setting on project.clj:

...

  :repositories {"releases"  {:url           "https://maven.pkg.github.com/my-organization-name/*"
                              :username      "pdelfino"
                              :password      :env}}

...

As you see, I can already use environment-variables for the password, since it was set on my .zshrc file:

export LEIN_PASSWORD="my-personal-access-token-which-will-not-be-shared"

I would like to do the same for the username! This would be particularly important since other folks are working on this project.

I tried a few things, but none of them worked out. One example of documentation only illustrates how to do it with the password (using LEIN_PASSWORD - see here) but does not solve the username part. Executing lein help sample generates the same content previously mentioned.

How do I fix this?

aloha_erich
  • 133
  • 8
Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
  • 1
    `:env/thenameofthevar` should do it? See https://codeberg.org/leiningen/leiningen/src/branch/main/doc/DEPLOY.md#credentials-in-the-environment – cfrick Oct 21 '22 at 15:05
  • Indeed, it worked out. I tried that earlier today. The problem was probably that it was necessary to refresh iTerm2 after tweaking `.zshrc`. – Pedro Delfino Oct 21 '22 at 15:13

1 Answers1

1

As suggested by @cfrick in a comment, the solution was adding the snippet below on my .zshrc file, use the pointer on project.clj, and re-starting the terminal:

  :repositories {"releases"  {:url           "https://maven.pkg.github.com/tallyfor/*"
                              :username      :env/LEIN_USERNAME 
                              :password      :env/LEIN_PASSWORD}}

export LEIN_USERNAME="pdelfino"
export LEIN_PASSWORD="my-personal-access-token-which-will-not-be-shared"

I tried that earlier today. But, forgot to re-start the terminal (iTerm2).

Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
  • Not really related to the problem, but just to mention it: you can `source` your `.zshrc` instead to read the exports afresh. – cfrick Oct 22 '22 at 12:54