After his retirement , Foley served as assistant secretary of energy for defense programs under President Ronald Reagan .