Allah has prescribed the prayer through the word of your Prophet ﷺ as four rak'ahs when resident, two when travelling, and one when danger is present. (Using translation from Muslim 687a)
«إِنَّ اللهَ فَرْضَ الصَّلَاةَ عَلَى لِسَانِ نَبِيِّكُمْ ﷺ فِي الْحَضَرِ أَرْبَعًا وَفِي السَّفَرِ رَكْعَتَيْنِ وَفِي الْخَوْفِ رَكْعَةٌ»