Here you check only for the presence of the "ip_disable_gw" key, and not for whether it is set to "true". This means that if you set the key to "false", the gateway will also be disabled.

We normally use the following pattern:

    if List.mem_assoc ip_disable_gw_key other_config && List.assoc ip_disable_gw_key other_config = "true" then .....