In a saute pan heat the oil and add the chile flakes. Be careful not to burn the chile, just toast to flavor the oil. Add the onions and sweat until soft. Add the ginger and bell pepper and saute for 1 to 2 minutes. Finally add the mango and cook for 1 more minute.
In a separate bowl, combine the pineapple juice, vinegar, and the sugar. Add this mixture to the pan. Stir to combine. Bring the mixture to a bare simmer and reduce. This can take 40 minutes to 2 hours stirring frequently. Its done when you can drag a spoon through and it leaves a wake. Season with salt and pepper. Jar.