more cache config cleanup

This commit is contained in:
FoxxMD
2026-07-28 01:56:26 +00:00
parent d96073282c
commit 70e4239e52
2 changed files with 3 additions and 30 deletions
+1 -28
View File
@@ -40,14 +40,6 @@ typeson.register({
]
});
const unsupportedEnvKeys = [
'CACHE_AUTH_CONN',
'CACHE_METADATA',
'CACHE_SCROBBLE',
'CACHE_SCROBBLE_CONN',
'CACHE_AUTH_CONN'
];
export class MSCache {
config: Required<CacheConfigOptions>
@@ -513,30 +505,11 @@ const noopKeyv: KeyvStoreAdapter = {
export const parseUserConfig = (config: CacheConfigUser = {}, parentLogger: Logger = loggerNoop): CacheConfigOptions => {
const logger = childLogger(parentLogger, 'Cache');
let valkeyEnvVal: string | undefined = nonEmptyStringOrDefault(process.env.CACHE_VALKEY);
if(valkeyEnvVal === undefined) {
valkeyEnvVal = nonEmptyStringOrDefault(process.env.CACHE_METADATA_CONN);
if(valkeyEnvVal !== undefined) {
logger.warn('ENV CACHE_METADATA_CONN is deprecated! Replace it with CACHE_VALKEY');
}
}
for(const key of unsupportedEnvKeys) {
if(nonEmptyStringOrDefault(process.env[key]) !== undefined) {
logger.warn(`ENV ${key} is no longer supported. Refer to the Caching docs.`);
}
}
const valkeyEnvVal: string | undefined = nonEmptyStringOrDefault(process.env.CACHE_VALKEY);
const {
valkey = valkeyEnvVal,
// metadata: {
// provider: mProvider = (process.env.CACHE_METADATA as (CacheMetadataProvider | undefined) ?? false),
// connection: mConn = process.env.CACHE_METADATA_CONN,
// //...restMetadata
// } = {},
auth: {
provider: aProvider = (process.env.CACHE_AUTH as (CacheAuthProvider | undefined) ?? 'file'),
//...restAuth
} = {}
} = config;
+2 -2
View File
@@ -274,12 +274,12 @@ export interface CacheConfigOptions {
}
export const cacheConfigUserAuthSchema = z.object({
provider: z.union([z.literal('valkey'), z.literal('file')]),
provider: z.enum(['valkey', 'file']),
}).meta({description: 'The cache type to use for Auth'});
export const cacheConfigUserSchema = z.object({
auth: cacheConfigUserAuthSchema.optional(),
valkey: z.string().optional()
valkey: z.string().optional().meta({description: 'The connection string to a valkey server with the syntax `redis://HOST_IP:HOST_PORT`'})
}).meta({title: 'Cache Config', description: 'Configuration for Caching'});
export type CacheConfigUser = z.infer<typeof cacheConfigUserSchema>;