Add fallback for optional env variable
This commit is contained in:
parent
c6130aff93
commit
e360981422
2 changed files with 3 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dotenv/config'
|
||||||
import { LastClient } from '@musicorum/lastfm'
|
import { LastClient } from '@musicorum/lastfm'
|
||||||
import {
|
import {
|
||||||
searchItunes,
|
searchItunes,
|
||||||
|
|
@ -14,7 +15,7 @@ const USERNAME = 'jedmund'
|
||||||
const ALBUM_LIMIT = 3
|
const ALBUM_LIMIT = 3
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const GET: RequestHandler = async ({ url }) => {
|
||||||
const client = new LastClient(LASTFM_API_KEY)
|
const client = new LastClient(LASTFM_API_KEY || '')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// const albums = await getWeeklyAlbumChart(client, USERNAME)
|
// const albums = await getWeeklyAlbumChart(client, USERNAME)
|
||||||
|
|
@ -94,7 +95,6 @@ async function searchItunesForAlbum(album: Album): Promise<Album> {
|
||||||
|
|
||||||
if (itunesResult && itunesResult.results.length > 0) {
|
if (itunesResult && itunesResult.results.length > 0) {
|
||||||
const firstResult = itunesResult.results[0]
|
const firstResult = itunesResult.results[0]
|
||||||
console.log(firstResult)
|
|
||||||
album.images.itunes = firstResult.artworkUrl100.replace('100x100', '600x600')
|
album.images.itunes = firstResult.artworkUrl100.replace('100x100', '600x600')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { RequestHandler } from './$types'
|
||||||
import SteamAPI, { Game, GameInfo, GameInfoExtended, UserPlaytime } from 'steamapi'
|
import SteamAPI, { Game, GameInfo, GameInfoExtended, UserPlaytime } from 'steamapi'
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params }) => {
|
export const GET: RequestHandler = async ({ params }) => {
|
||||||
const steam = new SteamAPI(process.env.STEAM_API_KEY)
|
const steam = new SteamAPI(process.env.STEAM_API_KEY || '')
|
||||||
try {
|
try {
|
||||||
const steamId = '76561197997279808'
|
const steamId = '76561197997279808'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue