Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion Cargo.lock

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

11 changes: 11 additions & 0 deletions bin/innit/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use innit_server::{
Config,
ConfigError,
ConfigFile,
Mode,
StandardConfigFile,
};
use si_service::prelude::*;
Expand Down Expand Up @@ -78,6 +79,15 @@ pub(crate) struct Args {
/// The address and port to bind the HTTP server to [example: 0.0.0.0:80]
#[arg(long, env)]
pub(crate) socket_addr: Option<String>,

/// Mode for parameter storage backend [options: env, ssm]
#[arg(
long = "mode",
env = "SI_INNIT_MODE",
default_value = "ssm",
hide_env_values = true
)]
pub(crate) mode: Mode,
}

impl TryFrom<Args> for Config {
Expand All @@ -91,6 +101,7 @@ impl TryFrom<Args> for Config {
if let Some(socket_addr) = args.socket_addr {
config_map.set("socket_addr", socket_addr);
}
config_map.set("mode", args.mode.to_string());
})?
.try_into()
}
Expand Down
4 changes: 2 additions & 2 deletions lib/bedrock-server/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use serde_json::{
Value,
json,
};
use si_data_ssm::ParameterStoreClientError;
use si_data_ssm::SsmParameterStoreClientError;
use thiserror::Error;

use super::{
Expand Down Expand Up @@ -62,7 +62,7 @@ pub fn public_routes(state: AppState) -> Router {
#[derive(Debug, Error)]
pub enum AppError {
#[error("parameter store client error: {0}")]
ParameterStoreClient(#[from] ParameterStoreClientError),
ParameterStoreClient(#[from] SsmParameterStoreClientError),
#[error("server error: {0}")]
Server(#[from] ServerError),
}
Expand Down
6 changes: 1 addition & 5 deletions lib/innit-core/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ rust_library(
name = "innit-core",
deps = [
"//lib/config-file:config-file",

"//third-party/rust:aws-sdk-ssm",
"//third-party/rust:chrono",
"//third-party/rust:serde",
"//third-party/rust:serde_json",
"//third-party/rust:ulid"
"//third-party/rust:serde"
],
srcs = glob([
"src/**/*.rs",
Expand Down
1 change: 0 additions & 1 deletion lib/innit-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ rust-version.workspace = true
publish.workspace = true

[dependencies]
aws-sdk-ssm = { workspace = true }
config-file = { path = "../../lib/config-file" }
serde = { workspace = true }
17 changes: 0 additions & 17 deletions lib/innit-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use aws_sdk_ssm::types::{
Parameter as AwsParameter,
ParameterType as AwsParameterType,
};
use config_file::parameter_provider::{
Parameter as ParameterProviderParameter,
ParameterType as ParameterProviderParameterType,
Expand All @@ -18,19 +14,6 @@ pub struct Parameter {
pub r#type: Option<ParameterType>,
}

impl From<AwsParameter> for Parameter {
fn from(p: AwsParameter) -> Self {
Self {
name: p.name().unwrap_or_default().to_string(),
value: p.value().map(|s| s.to_string()),
r#type: p.r#type().map(|t| match t {
AwsParameterType::StringList => ParameterType::StringList,
_ => ParameterType::String,
}),
}
}
}

impl From<Parameter> for ParameterProviderParameter {
fn from(p: Parameter) -> Self {
Self {
Expand Down
4 changes: 3 additions & 1 deletion lib/innit-server/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ rust_library(
"//lib/si-settings:si-settings",
"//lib/si-std:si-std",
"//lib/si-tls:si-tls",

"//lib/telemetry-rs:telemetry",
"//third-party/rust:async-trait",
"//third-party/rust:aws-sdk-ssm",
"//third-party/rust:axum",
"//third-party/rust:dashmap",
"//third-party/rust:derive_builder",
Expand All @@ -21,6 +22,7 @@ rust_library(
"//third-party/rust:remain",
"//third-party/rust:serde",
"//third-party/rust:serde_json",
"//third-party/rust:strum",
"//third-party/rust:thiserror",
"//third-party/rust:tokio",
"//third-party/rust:tokio-rustls",
Expand Down
2 changes: 2 additions & 0 deletions lib/innit-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rust-version.workspace = true
publish.workspace = true

[dependencies]
async-trait = { workspace = true }
axum = { workspace = true }
buck2-resources = { path = "../../lib/buck2-resources" }
dashmap = { workspace = true }
Expand All @@ -24,6 +25,7 @@ si-data-ssm = { path = "../../lib/si-data-ssm" }
si-settings = { path = "../../lib/si-settings" }
si-std = { path = "../../lib/si-std" }
si-tls = { path = "../../lib/si-tls" }
strum = { workspace = true }
telemetry = { path = "../../lib/telemetry-rs" }
thiserror = { workspace = true }
tokio = { workspace = true }
Expand Down
12 changes: 7 additions & 5 deletions lib/innit-server/src/app_state.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use axum::extract::FromRef;
use si_data_ssm::ParameterStoreClient;
use tokio_util::sync::CancellationToken;

use crate::parameter_cache::ParameterCache;
use crate::{
parameter_cache::ParameterCache,
parameter_storage::ParameterStore,
};

#[remain::sorted]
#[derive(Debug, Eq, PartialEq)]
Expand All @@ -11,20 +13,20 @@ pub enum ShutdownSource {}
#[derive(Clone, Debug, FromRef)]
pub struct AppState {
pub parameter_cache: ParameterCache,
pub parameter_store_client: ParameterStoreClient,
pub parameter_storage: ParameterStore,
shutdown_token: CancellationToken,
}

impl AppState {
#[allow(clippy::too_many_arguments)]
pub fn new(
parameter_cache: ParameterCache,
parameter_store_client: ParameterStoreClient,
parameter_storage: ParameterStore,
shutdown_token: CancellationToken,
) -> Self {
Self {
parameter_cache,
parameter_store_client,
parameter_storage,
shutdown_token,
}
}
Expand Down
30 changes: 29 additions & 1 deletion lib/innit-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ use si_std::{
CanonicalFileError,
};
use si_tls::CertificateSource;
use strum::{
Display,
EnumString,
};
use telemetry::prelude::*;
use thiserror::Error;
use ulid::Ulid;
Expand Down Expand Up @@ -49,7 +53,19 @@ impl ConfigError {

type Result<T> = std::result::Result<T, ConfigError>;

/// The config for the forklift server.
#[remain::sorted]
#[derive(
Debug, Default, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, EnumString, Display,
)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "lowercase")]
pub enum Mode {
Env,
#[default]
Ssm,
}

/// The config for the server.
#[derive(Debug, Builder)]
pub struct Config {
#[builder(default = "default_cache_ttl()")]
Expand Down Expand Up @@ -78,6 +94,9 @@ pub struct Config {

#[builder(default)]
dev_mode: bool,

#[builder(default = "Mode::default()")]
mode: Mode,
}

impl StandardConfig for Config {
Expand Down Expand Up @@ -124,6 +143,10 @@ impl Config {
pub fn client_ca_arns(&self) -> Option<&Vec<String>> {
self.client_ca_arns.as_ref()
}

pub fn mode(&self) -> Mode {
self.mode
}
}

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand All @@ -147,6 +170,9 @@ pub struct ConfigFile {

#[serde(default)]
pub dev_mode: bool,

#[serde(default)]
mode: Mode,
}

impl Default for ConfigFile {
Expand All @@ -161,6 +187,7 @@ impl Default for ConfigFile {
socket_addr: get_default_socket_addr(),
test_endpoint: default_test_endpoint(),
dev_mode: false,
mode: Mode::default(),
}
}
}
Expand All @@ -182,6 +209,7 @@ impl TryFrom<ConfigFile> for Config {
config.instance_id(value.instance_id);
config.quiescent_period(Duration::from_secs(value.quiescent_period_secs));
config.dev_mode(value.dev_mode);
config.mode(value.mode);
config.build().map_err(Into::into)
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/innit-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod app_state;
mod config;
mod middleware;
mod parameter_cache;
mod parameter_storage;
mod routes;
mod server;

Expand All @@ -11,8 +12,13 @@ pub use self::{
Config,
ConfigError,
ConfigFile,
Mode,
StandardConfigFile,
detect_and_configure_development,
},
parameter_storage::{
ParameterStore,
ParameterStoreKind,
},
server::Server,
};
Loading