Skip to content

Commit

Permalink
rename package and trim down before building back up
Browse files Browse the repository at this point in the history
  • Loading branch information
leoromanovsky committed Nov 16, 2024
1 parent 59f178e commit 30902a5
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 153 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[workspace]
resolver = "2"
members = [
"assignments",
"eppo_core",
"rust-sdk",
"python-sdk",
"ruby-sdk/ext/eppo_client",
"eppo_core",
"rust-sdk",
"python-sdk",
"ruby-sdk/ext/eppo_client",
"fastly-edge-assignments",
]

[patch.crates-io]
Expand Down
23 changes: 0 additions & 23 deletions assignments/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions assignments/fastly.toml

This file was deleted.

99 changes: 0 additions & 99 deletions assignments/src/main.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions assignments/Cargo.toml → fastly-edge-assignments/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "fastly-compute-project"
name = "fastly-edge-assignments"
version = "0.1.0"
authors = []
edition = "2018"
Expand All @@ -11,8 +11,7 @@ publish = false
debug = 1

[dependencies]
eppo = { version = "4.0.1", path = "../rust-sdk" }
eppo_core = { version = "4.1.0", path = "../eppo_core" }
fastly = "0.10.0"
fastly = "0.11.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
3 changes: 3 additions & 0 deletions fastly-edge-assignments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Eppo Assignments on Fastly Compute@Edge

TODO: Add a description
12 changes: 12 additions & 0 deletions fastly-edge-assignments/fastly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file describes a Fastly Compute package. To learn more visit:
# https://www.fastly.com/documentation/reference/compute/fastly-toml

authors = ["[email protected]"]
name = "Eppo Assignments on Fastly Compute@Edge"
description = "Performs assignments for Eppo's Fastly Compute@Edge service."
language = "rust"
manifest_version = 3
service_id = "oRzRuv2vBf6blqas2CyA96"

[scripts]
build = "cargo build --bin fastly-compute-project --release --target wasm32-wasi --color always"
File renamed without changes.
46 changes: 46 additions & 0 deletions fastly-edge-assignments/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use eppo_core::ufc::UniversalFlagConfig;
use eppo_core::SdkMetadata;
use fastly::http::StatusCode;
use fastly::{Error, Request, Response};
use serde_json::{json, Value};
use std::time::Instant;

fn get_subject_attributes(req: &Request) -> Value {
req.get_query_parameter("subjectAttributes")
.and_then(|v| serde_json::from_str(v).ok())
.unwrap_or_else(|| json!({}))
}

fn parse_ufc_configuration(ufc_config_json: Value) -> UniversalFlagConfig {
let config_json_bytes: Vec<u8> = serde_json::to_vec(&ufc_config_json).unwrap();
UniversalFlagConfig::from_json(
SdkMetadata {
name: "rust-sdk",
version: "4.0.1",
},
config_json_bytes,
)
.unwrap()
}

// fn offline_init(api_key: &str, ufc_config: UniversalFlagConfig) -> eppo::Client {
// let config = Configuration::from_server_response(ufc_config, None);
// let config_store = eppo_core::configuration_store::ConfigurationStore::new();
// config_store.set_configuration(Arc::new(config));
// let client = eppo::Client::new_with_configuration_store(
// ClientConfig::from_api_key(api_key),
// config_store.into(),
// );
// return client;
// }

#[fastly::main]
fn main(req: Request) -> Result<Response, Error> {
let start_time: Instant = Instant::now();

// Create an HTTP OK response
let response = Response::from_status(StatusCode::OK)
.with_body_text_plain("Request processed successfully");

Ok(response)
}

0 comments on commit 30902a5

Please sign in to comment.