-
Notifications
You must be signed in to change notification settings - Fork 87
Billing GraphQL #2883
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
base: master
Are you sure you want to change the base?
Billing GraphQL #2883
Changes from all commits
1d8abcc
d697d6d
fbeec34
fd4b273
8c2389a
68d3fce
98a8373
f0ac836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,12 @@ struct Args { | |
| /// The port to listen on for API requests. | ||
| #[clap(long, default_value = "8080", env = "API_PORT")] | ||
| api_port: u16, | ||
| /// Stripe secret API key. When provided, the billing GraphQL queries and | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is |
||
| /// mutations that interact with Stripe are enabled. Without this, those | ||
| /// operations return an error indicating billing is not configured. | ||
| #[derivative(Debug = "ignore")] | ||
| #[clap(long = "stripe-api-key", env = "STRIPE_API_KEY")] | ||
| stripe_api_key: Option<String>, | ||
| /// Whether to serve job handlers within this agent instance. | ||
| #[clap(long = "serve-handlers", env = "SERVE_HANDLERS")] | ||
| serve_handlers: bool, | ||
|
|
@@ -312,9 +318,15 @@ async fn async_main(args: Args) -> Result<(), anyhow::Error> { | |
| args.controller_config, | ||
| ); | ||
|
|
||
| // Wire up the agent's API Application and server. | ||
| let billing_provider: Option<Arc<dyn control_plane_api::billing::BillingProvider>> = | ||
| args.stripe_api_key.map(|api_key| { | ||
| Arc::new(control_plane_api::billing::StripeBillingProvider::new( | ||
| api_key, | ||
| )) as Arc<dyn control_plane_api::billing::BillingProvider> | ||
| }); | ||
| let api_app = Arc::new(App::new( | ||
| agent::id_generator::with_random_shard(), | ||
| billing_provider, | ||
| jwt_secret.as_bytes(), | ||
| pg_pool.clone(), | ||
| publisher.clone(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to
control_plane_apiso it could be shared, rather than duplicating it.