mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
more cache config cleanup
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user