Add permalink server config
clean up permalink server code