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

remove dotenv dependency #1815

Merged
merged 3 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ on:

env:
RUST_BACKTRACE: 1
DOCSRS_PREFIX: ignored/cratesfyi-prefix
DOCSRS_DATABASE_URL: postgresql://cratesfyi:password@localhost:15432
DOCSRS_LOG: docs_rs=debug,rustwide=info
AWS_ACCESS_KEY_ID: cratesfyi
AWS_SECRET_ACCESS_KEY: secret_key
S3_ENDPOINT: http://localhost:9000
DOCSRS_INCLUDE_DEFAULT_TARGETS: false
DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
SENTRY_ENVIRONMENT: dev

jobs:
build:
Expand Down Expand Up @@ -57,7 +66,6 @@ jobs:
- name: Launch postgres and min.io
run: |
cp .env.sample .env
. .env
mkdir -p ${DOCSRS_PREFIX}/public-html
docker-compose up -d db s3
# Give the database enough time to start up
Expand Down Expand Up @@ -93,7 +101,6 @@ jobs:
- name: Launch postgres and min.io
run: |
cp .env.sample .env
. .env
mkdir -p ${DOCSRS_PREFIX}/public-html
docker-compose up -d db s3
# Give the database enough time to start up
Expand All @@ -104,13 +111,12 @@ jobs:
- name: slow tests
env:
DOCSRS_INCLUDE_DEFAULT_TARGETS: true
DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
run: |
for f in ./test-binaries/*; do
echo "running $f"
chmod +x $f # GH action artifacts don't handle permissions
# run build-tests. Limited to one thread since we don't support parallel builds.
$f --ignored --test-threads=1 || exit 1
$f --ignored --test-threads=1 || exit 1
done

- name: Clean up the database
Expand Down
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ systemstat = "0.1.4"
prometheus = { version = "0.13.0", default-features = false }
rustwide = "0.15.0"
mime_guess = "2"
dotenv = "0.15"
zstd = "0.11.0"
git2 = { version = "0.14.4", default-features = false }
path-slash = "0.2.0"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ mkdir -p ignored/cratesfyi-prefix/crates.io-index
cargo build
# Start the external services
docker-compose up -d db s3
# anything that doesn't run via docker-compose needs the settings defined in
# .env. Either via `. .env` as below, or via any dotenv shell integration
(dotenv, direnv, ...).
jyn514 marked this conversation as resolved.
Show resolved Hide resolved
. .env
# Setup the database you just created
cargo run -- database migrate
# Build a sample crate to make sure it works
Expand Down
2 changes: 0 additions & 2 deletions src/bin/cratesfyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use structopt::StructOpt;
use strum::VariantNames;

fn main() {
let _ = dotenv::dotenv();

let _sentry_guard = if let Ok(sentry_dsn) = env::var("SENTRY_DSN") {
rustwide::logging::init_with(SentryLogger::with_dest(logger_init()));
Some(sentry::init((
Expand Down
2 changes: 0 additions & 2 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ use std::net::SocketAddr;
use std::{panic, sync::Arc};

pub(crate) fn wrapper(f: impl FnOnce(&TestEnvironment) -> Result<()>) {
let _ = dotenv::dotenv();

let env = TestEnvironment::new();
// if we didn't catch the panic, the server would hang forever
let maybe_panic = panic::catch_unwind(panic::AssertUnwindSafe(|| f(&env)));
Expand Down