cargo cranky: &'static

This commit is contained in:
Brandon Thomas committed 2023-08-15 23:56:03 -04:00
1 parent bd9c4d752f
commit f41833e4f4
57 files changed
+143 -143

No files matched your search

@@ -5,7 +5,7 @@ use crockford::crockford_entropy_lower;
// TODO: Generate these from a macro.
// TODO: Use a central path registry for quick reference
const MEDIA_UPLOAD_DIRECTORY : &'static str = "/media_upload";
const MEDIA_UPLOAD_DIRECTORY : &str = "/media_upload";
/// Directory for user media uploads.
/// Each uploaded file gets its own directory so that we can store the original
@@ -3,7 +3,7 @@ use crate::public::public_path::PublicPath;
use crockford::crockford_entropy_lower;
use std::path::PathBuf;
const ORIGINAL_FILE_BASENAME : &'static str = "original_upload.bin";
const ORIGINAL_FILE_BASENAME : &str = "original_upload.bin";
// TODO: Generate these from a macro.
@@ -4,7 +4,7 @@ use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_s
// TODO: Generate these from a macro.
// TODO: Use a central path registry for quick reference
const DIRECTORY: &'static str = "/voice_conversion";
const DIRECTORY: &str = "/voice_conversion";
/// Directory for voice conversion results.
/// Each result gets its own directory so that we can store the result
@@ -3,8 +3,8 @@ use crate::public::voice_conversion_results::directory::VoiceConversionResultDir
use crockford::crockford_entropy_lower;
use std::path::PathBuf;
const ORIGINAL_FILE_PREFIX : &'static str = "fakeyou_";
const ORIGINAL_FILE_SUFFIX : &'static str = ".wav";
const ORIGINAL_FILE_PREFIX : &str = "fakeyou_";
const ORIGINAL_FILE_SUFFIX : &str = ".wav";
// TODO: Generate these from a macro.
@@ -9,8 +9,8 @@ use std::sync::Arc;
use std::time::Duration;
use log::{error, warn};
const AUTHORIZATION_HEADER: &'static str = "Authorization";
const SESSION_COOKIE_NAME : &'static str = "session";
const AUTHORIZATION_HEADER: &str = "Authorization";
const SESSION_COOKIE_NAME : &str = "session";
/// A client to consume FakeYou's API via API sessions (vs user sessions).
pub struct FakeYouApiClient {
+1 -1
View File
@@ -40,7 +40,7 @@ pub struct ContainerEnvironment {
}
/// Environment variable for server environment.
const SERVER_ENVIRONMENT : &'static str = "SERVER_ENVIRONMENT";
const SERVER_ENVIRONMENT : &str = "SERVER_ENVIRONMENT";
pub fn bootstrap<P: AsRef<Path>>(args: BootstrapArgs<'_, P>) -> AnyhowResult<ContainerEnvironment> {
easyenv::init_all_with_default_logging(args.default_logging_override);
@@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex};
use std::time::Duration;
/// NB: There's only ONE ITEM of ONE TYPE in the cache. We can use a single key.
const CACHE_KEY : &'static str = "ITEM";
const CACHE_KEY : &str = "ITEM";
/// Store a single payload in the cache
/// There's only ONE ITEM of ONE TYPE in the cache.
@@ -7,7 +7,7 @@ use errors::AnyhowResult;
const DEFAULT_TTL_SECONDS : usize = 60;
const REDIS_KEY_PREFIX : &'static str = "_c";
const REDIS_KEY_PREFIX : &str = "_c";
// TODO: Async Redis
@@ -3,7 +3,7 @@
/// NB: `sqlx::query` is spammy and dumps all queries as "info"-level log lines.
/// NB: `hyper::proto::h1::io` is incredibly spammy and logs every chunk of bytes in very large files being downloaded.
pub const DEFAULT_RUST_LOG: &'static str = concat!(
pub const DEFAULT_RUST_LOG: &str = concat!(
"debug,",
"actix_web=info,",
"sqlx::query=warn,",
@@ -13,14 +13,14 @@ pub const DEFAULT_RUST_LOG: &'static str = concat!(
);
/// The default Redis connection string for use in development
pub const DEFAULT_REDIS_DATABASE_0_CONNECTION_STRING: &'static str = "redis://localhost/0";
pub const DEFAULT_REDIS_DATABASE_0_CONNECTION_STRING: &str = "redis://localhost/0";
/// The default Redis connection string for use in development
/// Database 1
pub const DEFAULT_REDIS_DATABASE_1_CONNECTION_STRING: &'static str = "redis://localhost/1";
pub const DEFAULT_REDIS_DATABASE_1_CONNECTION_STRING: &str = "redis://localhost/1";
/// The default MySql connection string for use in development
pub const DEFAULT_MYSQL_CONNECTION_STRING: &'static str = "mysql://storyteller:password@localhost/storyteller";
pub const DEFAULT_MYSQL_CONNECTION_STRING: &str = "mysql://storyteller:password@localhost/storyteller";
/// The number of results we return by default for paginated queries.
pub const DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE: u16 = 25;
@@ -1,7 +1,7 @@
use actix_web::HttpRequest;
use crate::request::get_request_header_optional::get_request_header_optional;
const API_TOKEN_HEADER : &'static str = "AUTHORIZATION";
const API_TOKEN_HEADER : &str = "AUTHORIZATION";
/// Get the optional API token sent with the request
pub fn get_request_api_token(request: &HttpRequest) -> Option<String> {
@@ -1,5 +1,5 @@
const DEFAULT_BINARY_MIMETYPE : &'static str = "application/octet-stream";
const DEFAULT_BINARY_MIMETYPE : &str = "application/octet-stream";
pub fn get_mimetype_for_bytes(bytes: &[u8]) -> Option<&'static str> {
infer::get(bytes)
@@ -1,6 +1,6 @@
use std::path::Path;
const DEFAULT_BINARY_MIMETYPE : &'static str = "application/octet-stream";
const DEFAULT_BINARY_MIMETYPE : &str = "application/octet-stream";
pub fn get_mimetype_for_file<P: AsRef<Path>>(file: P) -> std::io::Result<Option<&'static str>> {
infer::get_from_path(file)
@@ -34,9 +34,9 @@ pub async fn create_account(
args: CreateAccountArgs<'_>,
) -> Result<CreateAccountSuccessResult, CreateAccountError>
{
const INITIAL_PROFILE_MARKDOWN : &'static str = "";
const INITIAL_PROFILE_RENDERED_HTML : &'static str = "";
const INITIAL_USER_ROLE: &'static str = "user";
const INITIAL_PROFILE_MARKDOWN : &str = "";
const INITIAL_PROFILE_RENDERED_HTML : &str = "";
const INITIAL_USER_ROLE: &str = "user";
let user_token = Tokens::new_user()
.map_err(|_e| {
+1 -1
View File
@@ -173,7 +173,7 @@ mod tests {
use once_cell::sync::Lazy;
use crate::clean_symbols::clean_symbols;
const TIME_BOMB_EPOCH_STR : &'static str = "2023-11-01T00:00:00.00Z";
const TIME_BOMB_EPOCH_STR : &str = "2023-11-01T00:00:00.00Z";
static TIME_BOMB_EPOCH: Lazy<DateTime<Utc>> = Lazy::new(|| {
let datetime = DateTime::parse_from_rfc3339(TIME_BOMB_EPOCH_STR)
@@ -4,7 +4,7 @@ use once_cell::sync::Lazy;
use crate::text_pipelines::text_pipeline_type::TextPipelineType;
// TODO: This is not yet popularized
const ENGLISH_V1_EPOCH_STR : &'static str = "2023-01-01T00:00:00.00Z";
const ENGLISH_V1_EPOCH_STR : &str = "2023-01-01T00:00:00.00Z";
/// Date we consider to switch models to "english_v1" instead of "legacy_fakeyou"
static ENGLISH_V1_EPOCH : Lazy<DateTime<Utc>> = Lazy::new(|| {
@@ -47,11 +47,11 @@ pub enum TextPipelineType {
}
// TODO: Sucks to redefine enum variants. `serde_variant` looks like a fix, but it's GPL3.
const LEGACY_FAKEYOU : &'static str = "legacy_fakeyou";
const ENGLISH_V1 : &'static str = "english_v1";
const SPANISH_V1 : &'static str = "spanish_v1";
const SPANISH_V2 : &'static str = "spanish_v2";
const SYNTHETIC_LEGACY_FAKEYOU_2 : &'static str = "legacy_fakeyou_2";
const LEGACY_FAKEYOU : &str = "legacy_fakeyou";
const ENGLISH_V1 : &str = "english_v1";
const SPANISH_V1 : &str = "spanish_v1";
const SPANISH_V2 : &str = "spanish_v2";
const SYNTHETIC_LEGACY_FAKEYOU_2 : &str = "legacy_fakeyou_2";
impl TextPipelineType {
+1 -1
View File
@@ -7,7 +7,7 @@
#![forbid(unused_variables)]
#![forbid(warnings)]
pub (crate) const BANNED_SLURS : &'static str = include_str!("../../../../includes/binary_includes/banned_slurs.txt");
pub (crate) const BANNED_SLURS : &str = include_str!("../../../../includes/binary_includes/banned_slurs.txt");
pub mod check_for_slurs;
pub mod latin_alphabet;
@@ -6,15 +6,15 @@ use log::warn;
use rss::Channel;
// NB: Contains nearly 70 items
const RSS_TOP_STORIES : &'static str = "http://rss.cnn.com/rss/cnn_topstories.rss";
const RSS_TOP_STORIES : &str = "http://rss.cnn.com/rss/cnn_topstories.rss";
const RSS_WORLD : &'static str = "http://rss.cnn.com/rss/cnn_world.rss";
const RSS_WORLD : &str = "http://rss.cnn.com/rss/cnn_world.rss";
const RSS_US : &'static str = "http://rss.cnn.com/rss/cnn_us.rss";
const RSS_US : &str = "http://rss.cnn.com/rss/cnn_us.rss";
const RSS_TECH : &'static str = "http://rss.cnn.com/rss/cnn_tech.rss";
const RSS_TECH : &str = "http://rss.cnn.com/rss/cnn_tech.rss";
const RSS_ENTERTAINMENT : &'static str = "http://rss.cnn.com/rss/cnn_showbiz.rss";
const RSS_ENTERTAINMENT : &str = "http://rss.cnn.com/rss/cnn_showbiz.rss";
#[derive(Copy, Clone, Debug, EnumIter, EnumCount)]
pub enum CnnFeed {
@@ -5,7 +5,7 @@ use errors::AnyhowResult;
use log::warn;
use rss::Channel;
const GIZMODO_RSS : &'static str = "https://gizmodo.com/rss";
const GIZMODO_RSS : &str = "https://gizmodo.com/rss";
// TODO: Rename foo_feed() or foo_rss(), etc.
pub async fn gizmodo_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
@@ -5,7 +5,7 @@ use errors::AnyhowResult;
use log::warn;
use rss::Channel;
const KOTAKU_RSS: &'static str = "https://kotaku.com/rss";
const KOTAKU_RSS: &str = "https://kotaku.com/rss";
// TODO: Rename foo_feed() or foo_rss(), etc.
pub async fn kotaku_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
@@ -7,11 +7,11 @@ use rss::Channel;
use std::ops::Deref;
// NB: Feed contains ~20 items.
const MAIN_RSS_FEED : &'static str = "https://techcrunch.com/feed/";
const MAIN_RSS_FEED : &str = "https://techcrunch.com/feed/";
const VENTURE_FEED : &'static str = "https://techcrunch.com/category/venture/feed/";
const VENTURE_FEED : &str = "https://techcrunch.com/category/venture/feed/";
const STARTUPS_FEED : &'static str = "https://techcrunch.com/category/startups/feed/";
const STARTUPS_FEED : &str = "https://techcrunch.com/category/startups/feed/";
#[derive(Copy, Clone, Debug, EnumIter, EnumCount)]
pub enum TechcrunchFeed {
@@ -4,9 +4,9 @@ use errors::AnyhowResult;
use log::warn;
use rss::Channel;
const RSS_WORLD_NEWS : &'static str = "https://www.theguardian.com/world/rss";
const RSS_WORLD_NEWS : &str = "https://www.theguardian.com/world/rss";
const RSS_TECHNOLOGY : &'static str = "https://www.theguardian.com/technology/rss";
const RSS_TECHNOLOGY : &str = "https://www.theguardian.com/technology/rss";
// TODO: This hasn't been tested.
@@ -51,7 +51,7 @@ use web_scrapers::sites::techcrunch::techcrunch_article_scraper::techcrunch_arti
use workers::news_stories::phase_4::news_story_audio_final_verification::main_loop::news_story_audio_final_verification_main_loop;
use workers::news_stories::phase_5::news_story_post_production_finalization::main_loop::news_story_post_production_finalization_main_loop;
pub const LOG_LEVEL: &'static str = concat!(
pub const LOG_LEVEL: &str = concat!(
"info,",
"actix_web=info,",
"symphonia_core=warn,", // Symphonia is spammy af.
@@ -4,7 +4,7 @@ use log::info;
use path_absolutize::Absolutize;
use errors::{anyhow, AnyhowResult};
const DEFAULT_SAVE_DIRECTORY : &'static str = "runtime_data";
const DEFAULT_SAVE_DIRECTORY : &str = "runtime_data";
#[derive(Clone, Default)]
pub struct StartupArgs {
+6 -6
View File
@@ -60,13 +60,13 @@ use subprocess_common::docker_options::{DockerFilesystemMount, DockerGpu, Docker
use tokio::runtime::Runtime;
// Buckets
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_BUCKET_NAME : &'static str = "TTS_DOWNLOAD_BUCKET_NAME";
const ENV_BUCKET_ROOT : &'static str = "TTS_DOWNLOAD_BUCKET_ROOT";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
const ENV_BUCKET_NAME : &str = "TTS_DOWNLOAD_BUCKET_NAME";
const ENV_BUCKET_ROOT : &str = "TTS_DOWNLOAD_BUCKET_ROOT";
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
const DEFAULT_TEMP_DIR: &str = "/tmp";
#[tokio::main]
async fn main() -> AnyhowResult<()> {
@@ -10,7 +10,7 @@ use std::sync::Arc;
use bootstrap::bootstrap::ContainerEnvironment;
use jobs_common::job_stats::JobStats;
const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345";
const DEFAULT_BIND_ADDRESS : &str = "0.0.0.0:12345";
const DEFAULT_NUM_WORKERS : usize = 4;
pub struct CreateServerArgs {
@@ -29,7 +29,7 @@ use tts_common::text_pipelines::text_pipeline_type::TextPipelineType;
/// Text starting with this will be treated as a test request.
/// This allows the request to bypass the model cache and query the latest TTS model.
const TEST_REQUEST_TEXT: &'static str = "This is a test request.";
const TEST_REQUEST_TEXT: &str = "This is a test request.";
pub struct ProcessJobArgs<'a> {
@@ -31,7 +31,7 @@ use crate::job::job_loop::job_success_result::{JobSuccessResult, ResultEntity};
/// Text starting with this will be treated as a test request.
/// This allows the request to bypass the model cache and query the latest TTS model.
const TEST_REQUEST_TEXT: &'static str = "This is a test request.";
const TEST_REQUEST_TEXT: &str = "This is a test request.";
pub struct VitsProcessJobArgs<'a> {
+6 -6
View File
@@ -62,16 +62,16 @@ use std::time::Duration;
use subprocess_common::docker_options::{DockerEnvVar, DockerFilesystemMount, DockerGpu, DockerOptions};
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
// Bucket names
const ENV_PRIVATE_BUCKET_NAME : &'static str = "PRIVATE_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &'static str = "PUBLIC_BUCKET_NAME";
const ENV_PRIVATE_BUCKET_NAME : &str = "PRIVATE_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &str = "PUBLIC_BUCKET_NAME";
// HTTP sidecar
const ENV_TTS_INFERENCE_SIDECAR_HOSTNAME: &'static str = "TTS_INFERENCE_SIDECAR_HOSTNAME";
const ENV_TTS_INFERENCE_SIDECAR_HOSTNAME: &str = "TTS_INFERENCE_SIDECAR_HOSTNAME";
//#[tokio::main]
#[actix_web::main]
@@ -56,13 +56,13 @@ use std::time::Duration;
use tempdir::TempDir;
// Buckets
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_BUCKET_NAME : &'static str = "TTS_DOWNLOAD_BUCKET_NAME";
const ENV_BUCKET_ROOT : &'static str = "TTS_DOWNLOAD_BUCKET_ROOT";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
const ENV_BUCKET_NAME : &str = "TTS_DOWNLOAD_BUCKET_NAME";
const ENV_BUCKET_ROOT : &str = "TTS_DOWNLOAD_BUCKET_ROOT";
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
const DEFAULT_TEMP_DIR: &str = "/tmp";
struct Downloader {
pub download_temp_directory: PathBuf,
@@ -33,7 +33,7 @@ use tts_common::text_pipelines::text_pipeline_type::TextPipelineType;
/// Text starting with this will be treated as a test request.
/// This allows the request to bypass the model cache and query the latest TTS model.
const TEST_REQUEST_TEXT: &'static str = "This is a test request.";
const TEST_REQUEST_TEXT: &str = "This is a test request.";
#[derive(Deserialize, Default)]
struct FileMetadata {
@@ -66,25 +66,25 @@ use std::path::PathBuf;
use std::time::Duration;
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
// Bucket names
const ENV_PRIVATE_BUCKET_NAME : &'static str = "PRIVATE_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &'static str = "PUBLIC_BUCKET_NAME";
const ENV_PRIVATE_BUCKET_NAME : &str = "PRIVATE_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &str = "PUBLIC_BUCKET_NAME";
// Where models and other assets get downloaded to.
const ENV_SEMIPERSISTENT_CACHE_DIR : &'static str = "SEMIPERSISTENT_CACHE_DIR";
const ENV_SEMIPERSISTENT_CACHE_DIR : &str = "SEMIPERSISTENT_CACHE_DIR";
// Python code
const ENV_CODE_DIRECTORY : &'static str = "TTS_CODE_DIRECTORY";
const ENV_INFERENCE_SCRIPT_NAME : &'static str = "TTS_INFERENCE_SCRIPT_NAME";
const ENV_CODE_DIRECTORY : &str = "TTS_CODE_DIRECTORY";
const ENV_INFERENCE_SCRIPT_NAME : &str = "TTS_INFERENCE_SCRIPT_NAME";
// HTTP sidecar
const ENV_TTS_INFERENCE_SIDECAR_HOSTNAME: &'static str = "TTS_INFERENCE_SIDECAR_HOSTNAME";
const ENV_TTS_INFERENCE_SIDECAR_HOSTNAME: &str = "TTS_INFERENCE_SIDECAR_HOSTNAME";
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
const DEFAULT_TEMP_DIR: &str = "/tmp";
#[tokio::main]
async fn main() -> AnyhowResult<()> {
+10 -10
View File
@@ -58,24 +58,24 @@ use std::time::Duration;
use tempdir::TempDir;
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
// Buckets (private data)
const ENV_PRIVATE_BUCKET_NAME : &'static str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
const ENV_PRIVATE_BUCKET_NAME : &str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
// Buckets (public data)
const ENV_PUBLIC_BUCKET_NAME : &'static str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
// Various bucket roots
const ENV_DOWNLOAD_BUCKET_ROOT : &'static str = "W2L_DOWNLOAD_BUCKET_ROOT";
const ENV_DOWNLOAD_BUCKET_ROOT : &str = "W2L_DOWNLOAD_BUCKET_ROOT";
// Python code
const ENV_CODE_DIRECTORY : &'static str = "W2L_CODE_DIRECTORY";
const ENV_MODEL_CHECKPOINT : &'static str = "W2L_MODEL_CHECKPOINT";
const ENV_DOWNLOAD_SCRIPT_NAME : &'static str = "W2L_DOWNLOAD_SCRIPT_NAME";
const ENV_CODE_DIRECTORY : &str = "W2L_CODE_DIRECTORY";
const ENV_MODEL_CHECKPOINT : &str = "W2L_MODEL_CHECKPOINT";
const ENV_DOWNLOAD_SCRIPT_NAME : &str = "W2L_DOWNLOAD_SCRIPT_NAME";
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
const DEFAULT_TEMP_DIR: &str = "/tmp";
struct Downloader {
pub download_temp_directory: PathBuf,
@@ -55,24 +55,24 @@ use std::time::Duration;
use tempdir::TempDir;
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
// Buckets (private data)
const ENV_PRIVATE_BUCKET_NAME : &'static str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
const ENV_PRIVATE_BUCKET_NAME : &str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
// Buckets (public data)
const ENV_PUBLIC_BUCKET_NAME : &'static str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
// Where models and other assets get downloaded to.
const ENV_SEMIPERSISTENT_CACHE_DIR : &'static str = "SEMIPERSISTENT_CACHE_DIR";
const ENV_SEMIPERSISTENT_CACHE_DIR : &str = "SEMIPERSISTENT_CACHE_DIR";
// Python code
const ENV_CODE_DIRECTORY : &'static str = "W2L_CODE_DIRECTORY";
const ENV_MODEL_CHECKPOINT : &'static str = "W2L_MODEL_CHECKPOINT";
const ENV_INFERENCE_SCRIPT_NAME : &'static str = "W2L_INFERENCE_SCRIPT_NAME";
const ENV_CODE_DIRECTORY : &str = "W2L_CODE_DIRECTORY";
const ENV_MODEL_CHECKPOINT : &str = "W2L_MODEL_CHECKPOINT";
const ENV_INFERENCE_SCRIPT_NAME : &str = "W2L_INFERENCE_SCRIPT_NAME";
const DEFAULT_TEMP_DIR: &'static str = "/tmp";
const DEFAULT_TEMP_DIR: &str = "/tmp";
struct Inferencer {
pub download_temp_directory: PathBuf,
@@ -18,9 +18,9 @@ use twitch_api2::pubsub;
// Reference javascript Twitch Websocket client:
// https://github.com/twitchdev/pubsub-javascript-sample/blob/main/main.js
const WEBSOCKET_GATEWAY : &'static str = "wss://pubsub-edge.twitch.tv";
const WEBSOCKET_GATEWAY : &str = "wss://pubsub-edge.twitch.tv";
const PING_COMMAND : &'static str = "{ \"type\": \"PING\" }";
const PING_COMMAND : &str = "{ \"type\": \"PING\" }";
pub struct TwitchWebsocketClient {
socket: Option<WebSocketStream<MaybeTlsStream<TcpStream>>>,
@@ -1,5 +1,5 @@
//! Keys that are used as metadata frequently.
pub const METADATA_USER_TOKEN : &'static str = "user_token";
pub const METADATA_USERNAME : &'static str = "username";
pub const METADATA_EMAIL : &'static str = "email";
pub const METADATA_USER_TOKEN : &str = "user_token";
pub const METADATA_USERNAME : &str = "username";
pub const METADATA_EMAIL : &str = "email";
@@ -1,8 +1,8 @@
/// Subscription categories are used to namespace subscriptions.
/// Integrations should always provide a default even if this isn't used.
pub const UNKNOWN_SUBSCRIPTION_NAMESPACE: &'static str = "unknown";
pub const UNKNOWN_SUBSCRIPTION_NAMESPACE: &str = "unknown";
/// The integrated system has internal unique string key identifiers for
/// each subscription plan.
pub const UNKNOWN_SUBSCRIPTION_PRODUCT_SLUG: &'static str = "unknown";
pub const UNKNOWN_SUBSCRIPTION_PRODUCT_SLUG: &str = "unknown";
+2 -2
View File
@@ -1,8 +1,8 @@
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate serde_derive;
pub const RESERVED_USERNAMES : &'static str = include_str!("../../../../../includes/binary_includes/reserved_usernames.txt");
pub const RESERVED_SUBSTRINGS : &'static str = include_str!("../../../../../includes/binary_includes/reserved_usernames_including.txt");
pub const RESERVED_USERNAMES : &str = include_str!("../../../../../includes/binary_includes/reserved_usernames.txt");
pub const RESERVED_SUBSTRINGS : &str = include_str!("../../../../../includes/binary_includes/reserved_usernames_including.txt");
pub mod default_routes;
pub mod endpoints;
@@ -23,7 +23,7 @@ use std::collections::BTreeMap;
*/
const COOKIE_VERSION : u32 = 2;
const SESSION_COOKIE_NAME : &'static str = "session";
const SESSION_COOKIE_NAME : &str = "session";
// TODO(echelon,2022-08-29): Make a CryptedCookieManager that this uses.
// TODO(echelon,2022-08-29): Fix how domains and "secure" cookies are handled
+1 -1
View File
@@ -14,7 +14,7 @@ use crate::env_args::env_args;
use errors::AnyhowResult;
use http_server_common::cors::build_cors_config;
pub const DEFAULT_RUST_LOG: &'static str = concat!(
pub const DEFAULT_RUST_LOG: &str = concat!(
"debug,",
"actix_web=info,",
"hyper::proto::h1::io=warn,",
@@ -1,7 +1,7 @@
use billing_component::stripe::traits::internal_subscription_product_lookup::{InternalProductLookupError, InternalSubscriptionProduct, InternalSubscriptionProductLookup};
use crate::configs::plans::plan_list::{PLANS_BY_STRIPE_PRICE_ID, PLANS_BY_STRIPE_PRODUCT_ID};
const SUBSCRIPTION_CATEGORY : &'static str = "fakeyou";
const SUBSCRIPTION_CATEGORY : &str = "fakeyou";
/// A simple Actix injectable action
#[derive(Clone, Copy)]
@@ -4,7 +4,7 @@ use tokens::tokens::model_categories::ModelCategoryToken;
use tokens::tokens::tts_models::TtsModelToken;
use crate::http_server::endpoints::categories::tts::list_fully_computed_assigned_tts_categories::query_and_construct_payload::{CategoryTokenToModelTokensMap, TtsModelInfoLite};
const UNNAMED_MODEL_SORT_VALUE : &'static str = "unnamed";
const UNNAMED_MODEL_SORT_VALUE : &str = "unnamed";
struct SortableModelToken {
model_token: TtsModelToken,
@@ -1,7 +1,7 @@
use actix_web::cookie::{Cookie, CookieBuilder};
use crate::server_state::ServerState;
const REFRESH_COOKIE_NAME : &'static str = "refresh";
const REFRESH_COOKIE_NAME : &str = "refresh";
pub fn build_design_refresh_cookie(server_state: &ServerState, enable: bool) -> CookieBuilder {
let value = if enable { "true" } else { "false " };
@@ -1,5 +1,5 @@
pub const DEFAULT_INVESTOR_REDIRECT : &'static str = "https://fakeyou.com";
pub const DEFAULT_INVESTOR_REDIRECT : &str = "https://fakeyou.com";
pub fn redirect_is_allowed(redirect_url: &str) -> bool {
match redirect_url {
@@ -2,7 +2,7 @@
use actix_web::HttpRequest;
pub const STORYTELLER_DEMO_COOKIE_NAME : &'static str = "storyteller_demo";
pub const STORYTELLER_DEMO_COOKIE_NAME : &str = "storyteller_demo";
pub fn request_has_demo_cookie(http_request: &HttpRequest) -> bool {
// NB: Payload of the cookie does not matter.
@@ -1,7 +1,7 @@
use actix_web::cookie::Cookie;
use crate::server_state::ServerState;
pub const ALPHA_COOKIE_NAME : &'static str = "enable-alpha";
pub const ALPHA_COOKIE_NAME : &str = "enable-alpha";
pub fn alpha_cookie(server_state: &ServerState) -> Cookie {
Cookie::build(ALPHA_COOKIE_NAME, "true")
@@ -60,7 +60,7 @@ impl fmt::Display for DetectLocaleError {
// =============== Handler ===============
pub const FORCE_LOCALE_COOKIE_HEADER_NAME : &'static str = "force-locale";
pub const FORCE_LOCALE_COOKIE_HEADER_NAME : &str = "force-locale";
pub async fn detect_locale_handler(
http_request: HttpRequest,
@@ -7,11 +7,11 @@ use crate::server_state::ServerState;
use log::info;
use std::sync::Arc;
const CONTENT_TYPE : &'static str = "text/html; charset=utf-8";
const CONTENT_TYPE : &str = "text/html; charset=utf-8";
const ENABLE_LINK : &'static str = "<a href=\"/alpha?enable=true\">I want Vocodes 2.0</a>";
const DISABLE_LINK : &'static str = "<a href=\"/alpha?enable=false\">I don't want Vocodes 2.0</a>";
const STATUS_LINK : &'static str = "<a href=\"/alpha\">status</a>";
const ENABLE_LINK : &str = "<a href=\"/alpha?enable=true\">I want Vocodes 2.0</a>";
const DISABLE_LINK : &str = "<a href=\"/alpha?enable=false\">I don't want Vocodes 2.0</a>";
const STATUS_LINK : &str = "<a href=\"/alpha\">status</a>";
#[derive(Deserialize)]
@@ -27,8 +27,8 @@ use tts_common::text_pipelines::text_pipeline_type::TextPipelineType;
use user_input_common::check_for_slurs::contains_slurs;
use user_input_common::markdown_to_html::markdown_to_html;
const DEFAULT_IETF_LANGUAGE_TAG : &'static str = "en-US";
const DEFAULT_IETF_PRIMARY_LANGUAGE_SUBTAG : &'static str = "en";
const DEFAULT_IETF_LANGUAGE_TAG : &str = "en-US";
const DEFAULT_IETF_PRIMARY_LANGUAGE_SUBTAG : &str = "en";
/// For the URL PathInfo
#[derive(Deserialize)]
@@ -37,7 +37,7 @@ use user_input_common::check_for_slurs::contains_slurs;
use users_component::utils::user_session_extended::UserSessionExtended;
// TODO: Temporary for investor demo
const STORYTELLER_DEMO_COOKIE_NAME : &'static str = "storyteller_demo";
const STORYTELLER_DEMO_COOKIE_NAME : &str = "storyteller_demo";
/// Debug requests mean different things, depending on the type of worker (the legacy
/// tts-inference-job vs. the new inference-job):
@@ -49,19 +49,19 @@ const STORYTELLER_DEMO_COOKIE_NAME : &'static str = "storyteller_demo";
/// anything in the code. (There's a new system for routing requests called
/// "routing tags" that is independent of this flag.)
///
const DEBUG_HEADER_NAME : &'static str = "enable-debug-mode";
const DEBUG_HEADER_NAME : &str = "enable-debug-mode";
/// Requests with this header can be forced onto the new jobs system.
/// It'll be used to help test TT2 on the new system before it is rolled out for everyone.
const NEW_JOB_SYSTEM_HEADER_NAME : &'static str = "new-job-system";
const NEW_JOB_SYSTEM_HEADER_NAME : &str = "new-job-system";
/// The routing tag header can send workloads to particular k8s hosts.
/// This is useful for catching the live logs or intercepting the job.
/// NB: This is only for the new job system.
const ROUTING_TAG_HEADER_NAME : &'static str = "routing-tag";
const ROUTING_TAG_HEADER_NAME : &str = "routing-tag";
const USER_FAKEYOU_USER_TOKEN : &'static str = "U:N5J8JXPW9BTYX";
const USER_NEWS_STORY_USER_TOKEN : &'static str = "U:XAWRARC1N89X6";
const USER_FAKEYOU_USER_TOKEN : &str = "U:N5J8JXPW9BTYX";
const USER_NEWS_STORY_USER_TOKEN : &str = "U:XAWRARC1N89X6";
/// Safety guard against plans supporting too lengthy TTS inference text.
const MAX_TTS_LENGTH : usize = 10_000;
@@ -36,11 +36,11 @@ use tts_common::priority::FAKEYOU_INVESTOR_PRIORITY_LEVEL;
/// Debug requests can get routed to special "debug-only" workers, which can
/// be used to trial new code, run debugging, etc.
const DEBUG_HEADER_NAME : &'static str = "enable-debug-mode";
const DEBUG_HEADER_NAME : &str = "enable-debug-mode";
/// The routing tag header can send workloads to particular k8s hosts.
/// This is useful for catching the live logs or intercepting the job.
const ROUTING_TAG_HEADER_NAME : &'static str = "routing-tag";
const ROUTING_TAG_HEADER_NAME : &str = "routing-tag";
#[derive(Deserialize)]
pub struct EnqueueVoiceConversionInferenceRequest {
@@ -24,9 +24,9 @@ use std::sync::Arc;
use mysql_queries::queries::w2l::w2l_inference_jobs::insert_w2l_inference_job_extended::{insert_w2l_inference_job_extended, InsertW2lInferenceJobExtendedArgs};
use mysql_queries::queries::w2l::w2l_templates::check_w2l_template_exists::check_w2l_template_exists;
const BUCKET_AUDIO_FILE_NAME : &'static str = "input_audio_file";
const BUCKET_IMAGE_FILE_NAME: &'static str = "input_image_file";
const BUCKET_VIDEO_FILE_NAME : &'static str = "input_video_file";
const BUCKET_AUDIO_FILE_NAME : &str = "input_audio_file";
const BUCKET_IMAGE_FILE_NAME: &str = "input_image_file";
const BUCKET_VIDEO_FILE_NAME : &str = "input_video_file";
const MIN_BYTES : usize = 10;
const MAX_BYTES : usize = 1024 * 1024 * 20;
@@ -9,7 +9,7 @@ use limitation::{Limiter, Error};
use log::info;
/// If this HTTP header is set, the rate limiter can be bypassed (eg. for debugging)
const RATE_LIMIT_BYPASS_HEADER : &'static str = "limitless";
const RATE_LIMIT_BYPASS_HEADER : &str = "limitless";
#[derive(Clone)] // NB: Limiter is `Clone`
pub struct RedisRateLimiter {
@@ -17,8 +17,8 @@
#[macro_use] extern crate magic_crypt;
#[macro_use] extern crate serde_derive;
pub const RESERVED_USERNAMES : &'static str = include_str!("../../../../../includes/binary_includes/reserved_usernames.txt");
pub const RESERVED_SUBSTRINGS : &'static str = include_str!("../../../../../includes/binary_includes/reserved_usernames_including.txt");
pub const RESERVED_USERNAMES : &str = include_str!("../../../../../includes/binary_includes/reserved_usernames.txt");
pub const RESERVED_SUBSTRINGS : &str = include_str!("../../../../../includes/binary_includes/reserved_usernames_including.txt");
pub mod billing;
pub mod configs;
@@ -98,20 +98,20 @@ use users_component::utils::session_cookie_manager::SessionCookieManager;
use crate::memory_cache::model_token_to_info_cache::ModelTokenToInfoCache;
use crate::threads::poll_model_token_info_thread::poll_model_token_info_thread;
const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345";
const DEFAULT_BIND_ADDRESS : &str = "0.0.0.0:12345";
// Buckets (shared config)
const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY";
const ENV_SECRET_KEY : &'static str = "SECRET_KEY";
const ENV_REGION_NAME : &'static str = "REGION_NAME";
const ENV_ACCESS_KEY : &str = "ACCESS_KEY";
const ENV_SECRET_KEY : &str = "SECRET_KEY";
const ENV_REGION_NAME : &str = "REGION_NAME";
// Buckets (private data)
const ENV_PRIVATE_BUCKET_NAME : &'static str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
const ENV_PRIVATE_BUCKET_NAME : &str = "W2L_PRIVATE_DOWNLOAD_BUCKET_NAME";
// Buckets (public data)
const ENV_PUBLIC_BUCKET_NAME : &'static str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
const ENV_PUBLIC_BUCKET_NAME : &str = "W2L_PUBLIC_DOWNLOAD_BUCKET_NAME";
// Various bucket roots
const ENV_AUDIO_UPLOADS_BUCKET_ROOT : &'static str = "AUDIO_UPLOADS_BUCKET_ROOT";
const ENV_AUDIO_UPLOADS_BUCKET_ROOT : &str = "AUDIO_UPLOADS_BUCKET_ROOT";
#[actix_web::main]
async fn main() -> AnyhowResult<()> {
@@ -9,7 +9,7 @@ use std::collections::HashSet;
use std::thread;
use std::time::Duration;
const DYNAMIC_BAN_LIST_NAME : &'static str = "DYNAMIC_POLLING_IP_BAN_LIST";
const DYNAMIC_BAN_LIST_NAME : &str = "DYNAMIC_POLLING_IP_BAN_LIST";
pub async fn poll_ip_bans(
ip_ban_list: IpBanList,
@@ -47,7 +47,7 @@ use twitch_common::twitch_secrets::TwitchSecrets;
use twitch_oauth2::tokens::UserTokenBuilder;
use twitch_oauth2::{AppAccessToken, Scope, TwitchToken, tokens::errors::AppAccessTokenError, ClientId, ClientSecret};
const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:54321";
const DEFAULT_BIND_ADDRESS : &str = "0.0.0.0:54321";
#[actix_web::main]
//#[tokio::main]
+2 -2
View File
@@ -17,8 +17,8 @@ use std::pin::Pin;
use std::thread;
use std::time::Duration;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const TRACE_API_PATH: &'static str = "trace/v1";
const VERSION: &str = env!("CARGO_PKG_VERSION");
const TRACE_API_PATH: &str = "trace/v1";
/// Types that can be sent to a New Relic ingest API
///