Changeset View
Changeset View
Standalone View
Standalone View
services/feature-flags/src/service.rs
use crate::config::CONFIG; | |||||
use crate::database::{DatabaseClient, FeatureConfig, Platform}; | use crate::database::{DatabaseClient, FeatureConfig, Platform}; | ||||
use actix_web::{web, App, HttpServer}; | |||||
use comm_services_lib::database::Error; | use comm_services_lib::database::Error; | ||||
use std::collections::HashSet; | use std::collections::HashSet; | ||||
pub struct FeatureFlagsService { | pub struct FeatureFlagsService { | ||||
_db: DatabaseClient, | _db: DatabaseClient, | ||||
} | } | ||||
impl FeatureFlagsService { | impl FeatureFlagsService { | ||||
pub fn new(db_client: DatabaseClient) -> Self { | pub fn new(db_client: DatabaseClient) -> Self { | ||||
FeatureFlagsService { _db: db_client } | FeatureFlagsService { _db: db_client } | ||||
} | } | ||||
pub async fn _enabled_features_set( | pub async fn start(&self) -> std::io::Result<()> { | ||||
HttpServer::new(|| { | |||||
App::new().service(web::resource("/").to(|| async { "HELLO" })) | |||||
}) | |||||
.bind(("localhost", CONFIG.http_port))? | |||||
.run() | |||||
.await | |||||
} | |||||
async fn _enabled_features_set( | |||||
db: &DatabaseClient, | db: &DatabaseClient, | ||||
platform: Platform, | platform: Platform, | ||||
code_version: i32, | code_version: i32, | ||||
is_staff: bool, | is_staff: bool, | ||||
) -> Result<HashSet<String>, Error> { | ) -> Result<HashSet<String>, Error> { | ||||
let features_config = db.get_features_configuration(platform).await?; | let features_config = db.get_features_configuration(platform).await?; | ||||
Ok( | Ok( | ||||
features_config | features_config | ||||
Show All 35 Lines |