tokens:setup

Table of contents

  1. Introduction
  2. The forge token
    1. Another Forgejo or Gitea
    2. github.com
    3. Features from several forges
  3. The PyPI token
  4. Reloading after an edit
  5. Credentials it does not cover
  6. See also

Introduction

tokens:setup prints how to get the forge and PyPI tokens you need to release and to run the checks. It prints one section for the default host and one for every other host a feature of the selected product comes from, each with its own variables, scopes and token page. It takes no options.

splent tokens:setup
  SPLENT_FORGE_TOKEN
  Used by: feature:release, feature:versions, feature:upgrade,
           feature:search, check:forge

  How to get it:
    1. Open https://git.splent.io/user/settings/applications
    2. Generate a new token
    3. Enable scopes write:repository, write:organization, write:package
    4. Copy the token (shown only once)

  Add to your .env:
    SPLENT_FORGE_USER=<your git.splent.io username>
    SPLENT_FORGE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

  GITHUB_TOKEN
  Used to read private features on GitHub

  How to get it:
    1. Open https://github.com/settings/tokens
    2. Generate a new token
    3. Enable scopes repo, write:packages
    4. Copy the token (shown only once)

  Add to your .env:
    GITHUB_USER=<your github.com username>
    GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

  TWINE_USERNAME + TWINE_PASSWORD
  Used by: feature:release, check:pypi

  How to get it:
    1. Go to pypi.org → Account settings → API tokens
    2. Add API token
    3. Scope: 'Entire account' or limit to a specific project
    4. Copy the token (shown only once)

  Add to your .env:
    TWINE_USERNAME=__token__
    TWINE_PASSWORD=pypi-xxxxxxxxxxxxxxxxxxxxxxxxxxxx

The GitHub section shows up here because the product takes a feature from github.com. Put the tokens in the workspace .env, then run splent check:forge and splent check:pypi.


The forge token

Every release and every clone of a private repository use it. Set SPLENT_FORGE_USER too, since check:forge compares it with the token’s owner. git gets the token as a header, never in a URL, which needs git 2.31 or later.

Another Forgejo or Gitea

SPLENT_FORGE_HOST=git.example.org
SPLENT_FORGE_SSH_PORT=2222
SPLENT_FORGE_USER=your-username
SPLENT_FORGE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Variable Default
SPLENT_FORGE_HOST git.splent.io
SPLENT_FORGE_SSH_HOST SPLENT_FORGE_HOST
SPLENT_FORGE_SSH_PORT 2223 on git.splent.io, else 22
SPLENT_FORGE_API https://<host>/api/v1
SPLENT_FORGE_KIND github for github.com, else forgejo
SPLENT_CLONE_TRANSPORT SSH then HTTPS. Set https on a machine with no SSH key

github.com

SPLENT_FORGE_HOST=github.com
GITHUB_USER=your-username
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Create a classic token with the repo and write:packages scopes. Product images go to ghcr.io. On any forge the CLI reads SPLENT_FORGE_TOKEN and SPLENT_FORGE_USER first, then GITHUB_TOKEN and GITHUB_USER, unless the product also uses github.com, where those two belong to GitHub.

Features from several forges

A product can take features from more than one host, as Features from any forge explains. The variables above cover the default forge. Every other host reads its own token, named after it.

SPLENT_TOKEN_github_com=ghp_xxxxxxxxxxxxxxxxxxxxxxxx
SPLENT_USER_github_com=your-username
SPLENT_TOKEN_gitlab_com=glpat-xxxxxxxxxxxxxxxxxxxx

GITHUB_TOKEN, GH_TOKEN and GITLAB_TOKEN work for their hosts as well. Each token is sent to its own host only.


The PyPI token

With a token the username is always __token__. The CLI uses it whatever TWINE_USERNAME says, so you can leave it out. PYPI_USERNAME and PYPI_PASSWORD work too. A project-scoped token uploads only that project, so creating a new project needs an account-wide token and counts against PyPI’s new-project limits.


Reloading after an edit

The CLI reads .env on every run, but a variable your shell exports wins. make cli exports .env when you enter the container, so after you change a value there, by hand or with env:set, run source .env or open a new make cli. On the host, saving the file is enough.

env:show reports a stale export as loaded but differs.


Credentials it does not cover

Credential Where it comes from
The marketplace token splent login, never .env. Only spl:publish needs it
A UVLHub API key None. The marketplace holds one for everybody, so you never generate your own
DOCKERHUB_USERNAME, DOCKERHUB_PASSWORD .env, when a product lists dockerhub among its registries

See also


Back to top

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