build: unify sandbox and production cargo features as release (#1356)

This commit is contained in:
Sanchith Hegde
2023-06-07 13:35:30 +05:30
committed by GitHub
parent f0cd5ee20d
commit 695d3cdac2
4 changed files with 9 additions and 23 deletions

View File

@ -189,7 +189,7 @@ jobs:
- name: Cargo hack router
if: env.router_changes_exist == 'true'
run: cargo hack check --each-feature --skip kms,basilisk,production,kv_store,accounts_cache,openapi --no-dev-deps -p router
run: cargo hack check --each-feature --skip kms,basilisk,kv_store,accounts_cache,openapi --no-dev-deps -p router
- name: Cargo hack router_derive
if: env.router_derive_changes_exist == 'true'
@ -361,7 +361,7 @@ jobs:
- name: Cargo hack router
if: env.router_changes_exist == 'true'
run: cargo hack check --each-feature --skip kms,basilisk,production,kv_store,accounts_cache,openapi --no-dev-deps -p router
run: cargo hack check --each-feature --skip kms,basilisk,kv_store,accounts_cache,openapi --no-dev-deps -p router
- name: Cargo hack router_derive
if: env.router_derive_changes_exist == 'true'

View File

@ -1,6 +1,5 @@
FROM rust:slim as builder
ARG RUN_ENV=sandbox
ARG EXTRA_FEATURES=""
RUN apt-get update \
@ -33,7 +32,7 @@ ENV RUST_BACKTRACE="short"
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
COPY . .
RUN cargo build --release --features ${RUN_ENV} ${EXTRA_FEATURES}
RUN cargo build --release --features release ${EXTRA_FEATURES}

View File

@ -16,8 +16,7 @@ kms = ["external_services/kms","dep:aws-config"]
email = ["external_services/email","dep:aws-config"]
basilisk = ["kms"]
stripe = ["dep:serde_qs"]
sandbox = ["kms", "stripe", "basilisk", "s3", "email"]
production = ["kms", "stripe", "basilisk", "s3", "email"]
release = ["kms", "stripe", "basilisk", "s3", "email"]
olap = []
oltp = []
kv_store = []

View File

@ -241,11 +241,7 @@ pub async fn mk_add_card_request_hs(
customer_id: &str,
merchant_id: &str,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
} else {
customer_id.to_owned()
};
let merchant_customer_id = customer_id.to_owned();
let card = Card {
card_number: card.card_number.to_owned(),
name_on_card: card.card_holder_name.to_owned(),
@ -359,7 +355,7 @@ pub fn mk_add_card_request(
locker_id: &str,
merchant_id: &str,
) -> CustomResult<services::Request, errors::VaultError> {
let customer_id = if cfg!(feature = "sandbox") {
let customer_id = if cfg!(feature = "release") {
format!("{customer_id}::{merchant_id}")
} else {
customer_id.to_owned()
@ -398,11 +394,7 @@ pub async fn mk_get_card_request_hs(
merchant_id: &str,
card_reference: &str,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
} else {
customer_id.to_owned()
};
let merchant_customer_id = customer_id.to_owned();
let card_req_body = CardReqBody {
merchant_id,
merchant_customer_id,
@ -482,11 +474,7 @@ pub async fn mk_delete_card_request_hs(
merchant_id: &str,
card_reference: &str,
) -> CustomResult<services::Request, errors::VaultError> {
let merchant_customer_id = if cfg!(feature = "sandbox") {
format!("{customer_id}::{merchant_id}")
} else {
customer_id.to_owned()
};
let merchant_customer_id = customer_id.to_owned();
let card_req_body = CardReqBody {
merchant_id,
merchant_customer_id,