4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/vite_gdk.rb', line 4
def self.load_gdk_vite_config
return if ENV['RAILS_ENV'] == 'production'
return unless File.exist?(vite_gdk_config_path)
config = YAML.safe_load_file(vite_gdk_config_path)
enabled = config.fetch('enabled', false)
ViteRuby.env['VITE_ENABLED'] = enabled.to_s
return unless enabled
host = config['public_host'] || 'localhost'
ViteRuby.env['VITE_HMR_HOST'] = host
ViteRuby.configure(
host: host,
port: Integer(config['port'] || 3808),
https: config.fetch('https', { 'enabled' => false })['enabled']
)
end
|