Skip to main content

Repl Environment Metadata

In some cases, it's useful to retrieve some metadata about the current Repl you're in. Every Repl has some pre-populated environment variables, exposing some information about itself.

To access this data, first retrieve your Repl's environment variables.

Node.js

console.log(process.env);

Python

import os

print(os.environ)

Rust

use std::env;

fn main() {
for (key, value) in env::vars() {
println!("{}: {}", key, value);
}
}

To access a single environment variable from within a Repl, use the following examples:

Node.js

const variable = process.env.REPL_SLUG;
console.log(variable);

Python

import os

variable = os.environ.get('REPL_SLUG')
print(variable)

Rust

use std::env;

fn main() {
let variable = env::var("REPL_SLUG").unwrap();
println!("{}", variable);
}

Some useful environment variables accessible from within your Repl include:

keydescription
REPL_OWNERThe username of the owner of the Repl. If your Repl is text-based and has no webserver, REPL_OWNER will reflect the value of the current user accessing the Repl
REPLIT_DB_URLThe URL of your key-value Replit database
REPL_IDThe unique UUID string of your Repl
HOMEThe home path of your Repl
systemThe system name of your Repl
LANGText language and encoding
REPL_IMAGEThe docker image that corresponds to your Repl
REPL_LANGUAGEThe language of your Repl
REPL_PUBKEYSA stringified JSON object containing different public api keys
REPL_SLUGThe slug of your Repl
PRYBAR_FILEThe main/entrypoint file of your Repl