Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .conf validation Linux configuration #95

Closed
vicheanath opened this issue Nov 20, 2023 · 6 comments
Closed

Add .conf validation Linux configuration #95

vicheanath opened this issue Nov 20, 2023 · 6 comments

Comments

@vicheanath
Copy link
Contributor

vicheanath commented Nov 20, 2023

The .conf is a Linux configuration file

https://www.redhat.com/en/topics/management/what-are-configuration-files

https://docs.fileformat.com/programming/config/

for example :

worker_processes 1;

events {
	worker_connections 1024;
}

http {
	include mime.types;
	default_type application/octet-stream;
	sendfile on;
	keepalive_timeout 65;
	server {
		listen 80;
		server_name localhost;
		location / {
			root html;
			index index.php index.html index.htm;
		}
		location /live {
			types {
				application/vnd.apple.mpegurl m3u8;
			}
			alias /home/hls/live;
			add_header Cache-Control no-cache;
		}
		location /dash {
			alias /home/dash/live;
			add_header Cache-Control no-cache;
		}
	}
}

rtmp {

	server {
		listen 1935;
		chunk size 8192;
		
		application live {
			live on;
			allow publish 127.0.0.1;
			allow publish all;
			allow play all;
			record all;
			record_path /home/video_recordings;
			record_unique on;
			hls on;
			hls_nested on;
			hls_path /home/hls;
			hls_fragment 10s;
			dash on;
			dash_path /home/dash;
			dash_nested on;
		}

		# Video on Demand
		application vod {
			play /home/vod;
		}

		# Restream
		application restream {
			live on;
			# push server1:1935
			# push server2:1935
		}

	}

}
@zhenrong-wang
Copy link

The format of Linux conf file is not strict at all. Considering there are too many distros. I think this would be a hard work.

@vicheanath
Copy link
Contributor Author

The format of Linux conf file is not strict at all. Considering there are too many distros. I think this would be a hard work.

it's just my problem went I'm using it .conf on Nginx, and the validator should handle some paths not all types, especially nginx.conf. just idea

@kehoecj
Copy link
Collaborator

kehoecj commented Nov 21, 2023

Maybe we add support for nginx.conf specifically as it is its own custom config format. There is a go nginx config parser we can probably use. We'd have to lock it in to only detecting files named nginx.conf or some kind of wildcard like *.nginx.conf until we can implement some parts of #5

I can see a lot of value in using the config-file-validator for to catch issues in nginx.conf files - especially for if someone is utilizing different dev/test/prod configurations

@zhenrong-wang
Copy link

The format of Linux conf file is not strict at all. Considering there are too many distros. I think this would be a hard work.

it's just my problem went I'm using it .conf on Nginx, and the validator should handle some paths not all types, especially nginx.conf. just idea

Sure, as long as the format is strict, it can be checked and handled in a programmable way. My concern is that even for application level config file such as .nginx.conf, there might be too much freedom for the format. Anyway, I think it is totally feasible, just need to figure out all the rules of the format.
A good starting point may be listing out all the critical rules of the conf file's format.

@kehoecj
Copy link
Collaborator

kehoecj commented Dec 1, 2023

@vicheanath Are you okay closing this in favor of #100?

@vicheanath
Copy link
Contributor Author

that's fine for me.

@kehoecj kehoecj closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants