Created
          December 17, 2021 12:09 
        
      - 
      
- 
        Save keynslug/e1f07744741fcffba8bf22d645338552 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env escript | |
| %%! +sbtu +A0 -noshell -boot start_clean | |
| main([Config]) -> | |
| validate_config(Config); | |
| main([]) -> | |
| validate_config(find_sys_config()). | |
| validate_config(Config) -> | |
| Me = filename:basename(os:getenv("ESCRIPT_NAME")), | |
| case file:consult(Config) of | |
| {ok, _} -> | |
| _ = io:format(standard_io, "[~s] ~s is ok~n", [Me, Config]), | |
| erlang:halt(0); | |
| {error, Terms} -> | |
| _ = io:format(standard_io, "[~s] ~s is INVALID: ~0p~n", [Me, Config, Terms]), | |
| erlang:halt(1) | |
| end. | |
| find_sys_config() -> | |
| RootDir = os:getenv("RELEASE_ROOT_DIR"), | |
| ReleaseVsn = os:getenv("RELEASE_VSN"), | |
| filename:join([RootDir, "releases", ReleaseVsn, "sys.config"]). | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment