-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for more finegrained restriction on who is allowed to ope…
…n tunnels
- Loading branch information
Showing
6 changed files
with
177 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package fileutil | ||
|
||
import ( | ||
"bufio" | ||
"log" | ||
"os" | ||
"strings" | ||
) | ||
|
||
type AppConfigProperties map[string]string | ||
|
||
func ReadPropertiesFile(filename string) (AppConfigProperties, error) { | ||
config := AppConfigProperties{} | ||
|
||
if len(filename) == 0 { | ||
return config, nil | ||
} | ||
file, err := os.Open(filename) | ||
if err != nil { | ||
log.Fatal(err) | ||
return nil, err | ||
} | ||
defer file.Close() | ||
|
||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
if equal := strings.Index(line, "="); equal >= 0 { | ||
if key := strings.TrimSpace(line[:equal]); len(key) > 0 { | ||
value := "" | ||
if len(line) > equal { | ||
value = strings.TrimSpace(line[equal+1:]) | ||
} | ||
config[key] = value | ||
} | ||
} | ||
} | ||
|
||
if err := scanner.Err(); err != nil { | ||
log.Fatal(err) | ||
return nil, err | ||
} | ||
|
||
return config, nil | ||
} |
This file contains 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
This file contains 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
This file contains 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