-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename package and trim down before building back up
- Loading branch information
1 parent
59f178e
commit 30902a5
Showing
11 changed files
with
68 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Eppo Assignments on Fastly Compute@Edge | ||
|
||
TODO: Add a description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |