Refactor ssl config