()
| 4 | import os |
| 5 | |
| 6 | def main(): |
| 7 | appId = "" |
| 8 | if "AGORA_APP_ID" in os.environ: |
| 9 | appId = os.environ["AGORA_APP_ID"] |
| 10 | token = "" |
| 11 | |
| 12 | fileDirectory = "" |
| 13 | if "File_Directory" in os.environ: |
| 14 | fileDirectory = os.environ["File_Directory"] |
| 15 | |
| 16 | # KeyCenter.swift |
| 17 | KeyCenterPath = fileDirectory + "/KeyCenter.swift" |
| 18 | print("KeyCenterPath: %s" %KeyCenterPath) |
| 19 | |
| 20 | try: |
| 21 | f = open(KeyCenterPath, 'r+') |
| 22 | content = f.read() |
| 23 | appString = "\"" + appId + "\"" |
| 24 | tokenString = "\"" + token + "\"" |
| 25 | contentNew = re.sub(r'<#YOUR APPID#>', appString, content) |
| 26 | contentNew = re.sub(r'<#YOUR AppId#>', appString, contentNew) |
| 27 | contentNew = re.sub(r'<#YOUR Certificate#>', tokenString, contentNew) |
| 28 | f.seek(0) |
| 29 | f.write(contentNew) |
| 30 | f.truncate() |
| 31 | except IOError: |
| 32 | print("Swift File is not accessible.") |
| 33 | |
| 34 | # KeyCenter.m |
| 35 | KeyCenterPath = fileDirectory + "/KeyCenter.m" |
| 36 | |
| 37 | try: |
| 38 | f = open(KeyCenterPath, 'r+') |
| 39 | content = f.read() |
| 40 | appString = "@\"" + appId + "\"" |
| 41 | tokenString = "@\"" + token + "\"" |
| 42 | contentNew = re.sub(r'<#Your App Id#>', appString, content) |
| 43 | contentNew = re.sub(r'<#Temp Access Token#>', tokenString, contentNew) |
| 44 | f.seek(0) |
| 45 | f.write(contentNew) |
| 46 | f.truncate() |
| 47 | except IOError: |
| 48 | print("OC File is not accessible.") |
| 49 | |
| 50 | if __name__ == "__main__": |
| 51 | main() |
no test coverage detected