env:set

Introduction

env:set asks for the credentials of a host your features live on, or for your PyPI token, and writes them into the workspace .env, under the names the rest of the CLI reads. tokens:setup explains how to get each token.

splent env:set forge
git.splent.io username: splent-dev
git.splent.io access token:
✔ git.splent.io configuration updated.

💡 Remember to reload environment variables:
   source .env

The token is typed hidden.


Setting the forge credentials

env:set forge writes the user and token of one host, under the variables that host reads, SPLENT_FORGE_USER and SPLENT_FORGE_TOKEN for the default host and GITHUB_USER and GITHUB_TOKEN for github.com. check:forge lists them all. env:set github is a hidden alias.

When the selected product takes features from more than one host, it asks which one first. --host skips the question.

splent env:set forge --host github.com

Setting the PyPI token

splent env:set pypi

It asks for the token and writes TWINE_USERNAME=__token__ and TWINE_PASSWORD. feature:release, product:release, check:pypi and check:env read the token from there.


Using the wizard

splent env:set --wizard

A menu offers both, until you choose Exit. Without a subcommand or --wizard, splent env:set does nothing.


Reloading your shell

Inside the CLI container the shell exported .env when you entered it, and .env never overrides a variable the shell holds. So a changed token stays stale until you run source .env or open a new shell. A variable new to .env needs no reload. See Reloading after an edit.


Advanced

When the CLI reads another variable before the ones it writes, env:set forge removes that one from .env, so the old value does not stay in use. On a workspace whose default host is github.com, that means SPLENT_FORGE_USER and SPLENT_FORGE_TOKEN. It says so, and when your shell exports one of them itself it tells you to unset it.


Reference

Subcommand or option Asks for Writes
forge The host, when there is more than one, then username and access token The variables of that host, such as SPLENT_FORGE_USER and SPLENT_FORGE_TOKEN
forge --host <host> Username and access token The variables of <host>
pypi PyPI token TWINE_USERNAME=__token__ and TWINE_PASSWORD
--wizard Either, from a menu The same

It edits .env line by line. Comments, blank lines, the order and every untouched line stay. A variable already defined is updated in place, keeping an export prefix, and a later duplicate of it is dropped. A new one is appended. A value with a newline is refused.

The file is replaced in one atomic write that keeps its mode and owner. A failed write stops with Could not write <path> (<reason>). The previous file is unchanged.

The product’s environment, dev or prod, is not set here. product:up and product:deploy write SPLENT_ENV into the product’s docker/.env (see product:env).


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es